phpstan-drupal
phpstan-drupal copied to clipboard
Extension for PHPStan to allow analysis of Drupal code.
Using drupal-check I'm getting ```shell Access to an undefined property Symfony\Component\Validator\Constraint::$alreadyExists. ``` But my ... > Validation > Constraint > UniqueItem.php I have public $alreadyExists = ... and I'm calling...
I noticed an issue where arguments to classes in the services file were not verified against the class->__construct() at any phpstan runlevel. Is this something that would be fixable? Our...
I've got a custom ContentEntity with the following: ``` /** * {@inheritdoc} */ public function getOrderItem(): ?OrderItemInterface { return $this->get('order_item')->entity; } ``` and PHPStan level 3 is spitting out `Method...
Service definition: ``` config.storage.schema: class: Drupal\Core\Config\ExtensionInstallStorage arguments: ['@config.storage', 'config/schema', '', true, '%install_profile%'] ``` __construct ``` public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE, $profile =...
Due to generating the fake TestCase, maybe that's why. We should make it an explicit rule anyway.
``` if (method_exists($this->moduleHandler, 'invokeAllWIth')) { $this->moduleHandler->invokeAllWith('mail', function (callable $hook, string $module) use (&$list) { $list[$module] = $this->moduleHandler->getName($module); }); } else { foreach ($this->moduleHandler->getImplementations('mail') as $module) { $list[$module] = $this->moduleHandler->getName($module); }...
I had the following class in a custom module in my Drupal 8.9 codebase. upgrade_status didn't detect that this needed to implement TrustedCallbackInterface for the lazy builder callback. ```
Hello, This one is coming from https://www.drupal.org/project/drupal/issues/3265408 If I'm not mistaken, https://github.com/mglaman/phpstan-drupal/blob/main/src/Rules/Drupal/RenderCallbackRule.php is unable to detect whether the #pre_render callable class uses a trait. In the issue above MR, the...
missing explicit accessCheck is not detected on 1.1.16 but this is detected on 1.1.15 ``` $query = \Drupal::entityQuery('user') ->condition('status', 1) ->condition('uid', 1, '') ->condition('field_profile_visibility', 1) ->condition('field_account_type', '', '') ->condition('field_last_name.value', '',...