phpcs-import-detection icon indicating copy to clipboard operation
phpcs-import-detection copied to clipboard

A set of phpcs sniffs to look for unused or unimported symbols.

Results 10 phpcs-import-detection issues
Sort by recently updated
recently updated
newest added

With configuration: ``` ``` A false positive is occurring: "Found unimported symbol 'dbDelta'." I can see `dbdelta` (lowercase) is included in `WordPressSymbols.php`. Question: Should the symbol list be case insensitive,...

bug

PHP 8 uses `T_NAME_QUALIFIED` [as the token type](https://wiki.php.net/rfc/namespaced_names_as_token) for symbols like `Foo\Bar` (previously, each section of an imported symbol appeared as a `T_STRING` separated by `T_NS_SEPARATOR` but now it appears...

bug

Code like this (specifically: `&`) triggers a false positive for `ImportDetection.Imports.RequireImports.Symbol`: ```php class Foo { private static $something = 'foobar'; public &function bar() { return self::$something; } } ```

bug

Fixes https://github.com/sirbrillig/phpcs-import-detection/issues/52 Needs tests and also probably needs more work.

For a line like this: ``` use function Code\find_first_name; ``` We get the error `Found unused symbol 'function'.`

bug

I'm trying to use the PHP8 [nullsafe operator](https://wiki.php.net/rfc/nullsafe_operator) but I'm getting an issue from PHP Code Sniffer as `ImportDetection.Imports.RequireImports.Symbol`. So in the context of a class method this is fine:...

bug

In the following code, `Route` is imported and used, but is being reported as unused. Conversely, `Method` is used without being imported, but PHPCS does not mind. ```php

enhancement
help wanted

```php \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

enhancement
help wanted

Many of laravel helper functions like **app()**, **request()** e.g. $credentials = request(['username', 'password']); and build in **throw new Exception()**, and some of **self-created function** etc.s are showing warning with **Found...

enhancement