| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Partial namespace references like Mockery\MockInterface were not being flagged by ReferenceUsedNamesOnly because Slevomat's allowPartialUses defaults to true. Set it to false so such references are required to be imported via a use statement.
|
Won't this throw error for current usages like https://github.com/cakephp/cakephp/blob/d70712c983e6879bfcddd67d975d4b8ef3328aae/src/Database/TypeFactory.php#L33 ? |
Sorry, something went wrong.
|
This goes into 6.x right now, we can backport it, but thats indeed a bit breaking. |
Sorry, something went wrong.
|
technically nothing can break, its just a code style change. I'd say this can stay in 6.x |
Sorry, something went wrong.
Sorry, something went wrong.
|
My point was this rule is a bit too pedantic for my liking. |
Sorry, something went wrong.
|
If the latest PER standard allows such partial usages then I would be in favor of keeping it. |
Sorry, something went wrong.
|
Partials make the review much harder for humans IMO, as you need to scope in the context then always (you cannot directly see if this is root level or nested namespace). Disallow partial uses Pros
Cons
|
Sorry, something went wrong.
|
I don't mind either way, i just thought its obvious to keep it more consistent. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #430.
Partial namespace references like Mockery\MockInterface (as opposed to the FQCN form \Mockery\MockInterface) were not flagged by SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly because Slevomat's allowPartialUses property defaults to true.
Setting it to false makes the sniff flag such references so they must be imported via a use statement.
Before
After
The FQCN form (\Mockery\MockInterface) was and remains flagged by the same sniff.
Note: this is a behavior-tightening change. Downstream code that intentionally uses partial imports would be affected - but I guess thats fair enough as they could change it back themselves.