phpstan-drupal icon indicating copy to clipboard operation
phpstan-drupal copied to clipboard

Extension for PHPStan to allow analysis of Drupal code.

Results 161 phpstan-drupal issues
Sort by recently updated
recently updated
newest added

# Feature request With variation cache there are bugs being found due to multiple return logic steps and missing cacheable metadata in each return. So a rule which finds methods...

enhancement

Fixes the following issue (and other similar issues) when `checkFunctionArgumentTypes: true` is enabled ``` Parameter #1 $items of method Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase::getEntitiesToView() expects Drupal\Core\Field\EntityReferenceFieldItemListInterface, Drupal\Core\Field\FieldItemListInterface given. ```

Hi there. I've seen a previous issue with a similar report, but don't seem to have the same cause. I have phpstan/extension-installer included in my composer.json and the files exist...

bug

# Bug report After stubbing entity reference formatters, we now get: ``` Method Drupal\Core\Field\FormatterPluginManager::getInstance() return type with generic interface Drupal\Core\Field\FormatterInterface does not specify its types: T ``` ### Code snippet...

bug

#635 Update of https://github.com/mglaman/phpstan-drupal/pull/702 This helps in cases when PHPStan is called outside of the main website location. This is still relevant in cases when tooling is outside of Drupal...

The type support when doing something like this is quite lacking currently: ```php BaseFieldDefinition::create('list_string') ->setLabel('Test field') ->setSetting('allowed_values', ['foo' => 'Foo]) ->setDefaultValue($bar); ``` PR:s like https://github.com/mglaman/phpstan-drupal/pull/784 and the tracking issue of...

enhancement

# Bug report Render elements should be able to use dependency injection, but `\Drupal` global is allowed in render elements in this following rule: https://github.com/mglaman/phpstan-drupal/blob/d30fbd74132e86bf635aec49cc0597156a109ba4/src/Rules/Drupal/GlobalDrupalDependencyInjectionRule.php#L43-L45

bug

# Feature request In https://www.drupal.org/project/drupal/issues/2723579 we realised that although we have deprecation support for routes, this doesn't work for RouteMatch::getRouteName() because that only returns a string for the current route....

enhancement

_This was initially mentioned in #818, but since it closed with the PR automatically and I can't reopen it, I'll duplicate my proposal/question._ ## Problem/motivation Currently, some Drupal-specific information is...

enhancement