Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sniff to require use statements #342

Merged
merged 2 commits into from
Aug 28, 2021
Merged

Add sniff to require use statements #342

merged 2 commits into from
Aug 28, 2021

Conversation

othercorey
Copy link
Member

@othercorey othercorey added this to the 5.0 milestone Aug 25, 2021
@dereuromark
Copy link
Member

You might want to exclude certain parts here, the downside would be otherwise that any ... const/func would autofix to use statement:

use const JSON_ERROR_NONE;

and we didn't decide yet to spam the use block with also constants, functions and CO :)
For now this should probably be limited to class/interface/trait references only.

@dereuromark
Copy link
Member

dereuromark commented Aug 25, 2021

It also blindly converts e.g.

// @see \...\TransferToEntityMapper::mapEntity()

into a use statement, also killing the original docblock..
which is just bonkers, that's a docblock and shouldn't be touched.
So I guess it has some small bugs that also need solving first.

I opened up a ticket for now slevomat/coding-standard#1265
But I would be careful with adding this one, as it can also effect projects or plugin code

@othercorey
Copy link
Member Author

I didn't see that happen in any of the type changes I made, but there's no rush while your issue is resolved.

@othercorey
Copy link
Member Author

Looks like the slevomat bug was patched. Is this ok now?

@ADmad
Copy link
Member

ADmad commented Aug 28, 2021

Don't want things like use const JSON_ERROR_NONE;.

@othercorey
Copy link
Member Author

Don't want things like use const JSON_ERROR_NONE;.

I believe that can be disabled with allowFallbackGlobalConstants

@othercorey othercorey merged commit e098e1f into 5.0 Aug 28, 2021
@othercorey othercorey deleted the othercorey-patch-1 branch August 28, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants