mglaman / phpstan-drupal

Extension for PHPStan to allow analysis of Drupal code.
https://phpstan-drupal.mglaman.dev/
MIT License
196 stars 76 forks source link

getAggregateQuery() entity query access check false report #474

Closed mstenta closed 1 year ago

mstenta commented 2 years ago

Probably a follow-up to the improvements that were made in https://github.com/mglaman/phpstan-drupal/pull/454...

The following code is resulting in PHPStan error: "Missing explicit access check on entity query."

$query = $this->entityTypeManager->getStorage($entity_type)->getAggregateQuery()
  ->accessCheck(TRUE)
  ->condition('type', $bundle);

Perhaps we just need to accommodate getAggregateQuery()? Or is there a "correct" way to structure the code to make PHPStan happy? :-)

Boegie commented 1 year ago

Added a PR to try and fix getAggregateQuery() problems.