Closed rickdenhaan closed 2 years ago
Same here. The proposed workaround helps. But I agree that it is not a good solution to move and copy all create() functions from abstract base classes to all children.
Same here. But I get also false positives for code pieces like this:
$definitions = $plugin_manager->getDefinitions();
return array_map(static function ($definition) {
return $definition['label'];
}, $definitions);
Sorry for the regression! Thanks for the fix, @arkener! I'll put out a patch release shortly as soon as I check out https://github.com/sirbrillig/phpcs-variable-analysis/issues/271
After running
composer up
we received an updated version ofphpcs-variable-analysis
from v2.11.4 to v2.11.5 (no other PHP_CodeSniffer-related updates). Since then we're receiving warnings in custom services in our Drupal application:These warnings are about this code inside a PHP class:
We can work around the errors by explicitly naming the class we want to return (i.e.
return new ResultResponseController(
) but this will be inaccurate for some locations where this static::create
method exists in an abstract base class.Could this be caused by the recent change to static declaration checks (https://github.com/sirbrillig/phpcs-variable-analysis/pull/267)?