phpcs-import-detection
phpcs-import-detection copied to clipboard
Feature: warn on FQCN usage
\DrivingTracker\registerDrive($this); // this is fine because it's fully-qualified
Could we have a sniff that is triggered when FQCN is found?
https://github.com/sirbrillig/phpcs-import-detection/blob/572bb1dd8a6b0d15c18abef60695a049e02fac8c/ImportDetection/Sniffs/Imports/RequireImportsSniff.php#L56-L59
fully_qualified_strict_types in PHP-CS-Fixer detects only imported ones.
So: an additional warning for fully-qualified symbols? Yes, that's certainly do-able. Probably a good idea so that users can have more customization options for this sniff. I'm curious about the use-case?
I'm curious about the use-case?
Here it is: someone typed non-imported FQCN-s into our codebase: https://github.com/nunomaduro/larastan/pull/529 and Nuno is looking for a warning + automated fix.
Ahh, right. That makes sense. Thanks!