class EntityQueryHasAccessCheckRule
@implements Rule<Node\Expr\MethodCall>
Hierarchy
- class \mglaman\PHPStanDrupal\Rules\Drupal\EntityQuery\EntityQueryHasAccessCheckRule implements \PHPStan\Rules\Rule
Expanded class hierarchy of EntityQueryHasAccessCheckRule
File
-
vendor/
mglaman/ phpstan-drupal/ src/ Rules/ Drupal/ EntityQuery/ EntityQueryHasAccessCheckRule.php, line 18
Namespace
mglaman\PHPStanDrupal\Rules\Drupal\EntityQueryView source
final class EntityQueryHasAccessCheckRule implements Rule {
public function getNodeType() : string {
return Node\Expr\MethodCall::class;
}
public function processNode(Node $node, Scope $scope) : array {
$name = $node->name;
if (!$name instanceof Node\Identifier) {
return [];
}
if ($name->toString() !== 'execute') {
return [];
}
$type = $scope->getType($node);
if (!$type instanceof EntityQueryExecuteWithoutAccessCheckCountType && !$type instanceof EntityQueryExecuteWithoutAccessCheckType) {
return [];
}
$parent = $scope->getType($node->var);
if ($parent instanceof ConfigEntityQueryType) {
return [];
}
return [
RuleErrorBuilder::message('Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \\Drupal\\Core\\Entity\\Query\\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.')->tip('See https://www.drupal.org/node/3201242')
->build(),
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
EntityQueryHasAccessCheckRule::getNodeType | public | function | |
EntityQueryHasAccessCheckRule::processNode | public | function |