phpfmt_stable icon indicating copy to clipboard operation
phpfmt_stable copied to clipboard

Disable the option of removing a class importing on save state if don't exist inside the file

Open giwrgos88 opened this issue 8 years ago • 3 comments

I have created a class which binds dynamically interfaces and classes from an array. Instead of adding the class namespace in the array e.g

$classes =['\Test\Model\Test'];

I want to add it as use on the top of the file. screen shot 2016-08-04 at 10 23 44

When I'm saving the file phpftm formats the code and removes the use because it can't detect that the class that I have mentioned on the top is the one on the array. Is there anyway to disable this features so that the phpftm doesn't removes classes which are not mentioned in the file?

giwrgos88 avatar Aug 04 '16 07:08 giwrgos88

Hi @giwrgos88 did you find a way to solve it?

rodrigocnascimento avatar Nov 12 '16 12:11 rodrigocnascimento

@rodrigocnascimento not yet

giwrgos88 avatar Nov 14 '16 07:11 giwrgos88

try these in your phpfmt.sublime.config

	"format_on_save": false,
	"passes":
	[
		"OnlyOrderUseClauses"
	],

or just ctrl+shift+p and try enable/disable additional transformations

lain0 avatar Feb 13 '17 10:02 lain0