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

Feature: warn on FQCN usage #41

Open
szepeviktor opened this issue Jun 20, 2020 · 4 comments
Open

Feature: warn on FQCN usage #41

szepeviktor opened this issue Jun 20, 2020 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@szepeviktor
Copy link

szepeviktor commented Jun 20, 2020

    \DrivingTracker\registerDrive($this); // this is fine because it's fully-qualified

Could we have a sniff that is triggered when FQCN is found?

// If the symbol is a fully-qualified namespace, ignore it
if ($symbol->isAbsoluteNamespace()) {
$this->debug('found absolute namespaced symbol: ' . $symbol->getName());
return;

@szepeviktor
Copy link
Author

fully_qualified_strict_types in PHP-CS-Fixer detects only imported ones.

@sirbrillig
Copy link
Owner

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?

@szepeviktor
Copy link
Author

szepeviktor commented Jun 25, 2020

I'm curious about the use-case?

Here it is: someone typed non-imported FQCN-s into our codebase: larastan/larastan#529 and Nuno is looking for a warning + automated fix.

@sirbrillig
Copy link
Owner

Ahh, right. That makes sense. Thanks!

@sirbrillig sirbrillig added enhancement New feature or request help wanted Extra attention is needed labels Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants