phpstan-drupal
phpstan-drupal copied to clipboard
accessCheck deprecation not detected if query returned from method
Bug report
This is just the hardest deprecation to detect...
My guess is that because the query is setup in one method but the execution happens in several others the detection is never triggered.
Code snippet that reproduces the problem
I think this should be an accurate example of the problem. I had a helper that setup a base query that was used in several parts of the class to target a specific node type in a specific state.
class Foo {
public function test1() {
$this->getNodeQuery()->condition('field_two', 'bugaloo')->execute();
}
private function getNodeQuery() {
return \Drupal::entityQuery('node')
->accessCheck(TRUE)
->condition('type', 'node_type')
->condition('status', 1)
->sort('field_publish_date', 'DESC');
}
}
Similar to https://github.com/mglaman/phpstan-drupal/issues/437
yeah for sure. Only reported it separate because wasn't sure they could be fixed the same way.
😅 probably definitely not