function ShouldCallParentMethodsRule::hasParentClassCall
*
Parameters
Node\Stmt[]|null $stmts: *
1 call to ShouldCallParentMethodsRule::hasParentClassCall()
- ShouldCallParentMethodsRule::processNode in vendor/
phpstan/ phpstan-phpunit/ src/ Rules/ PHPUnit/ ShouldCallParentMethodsRule.php
File
-
vendor/
phpstan/ phpstan-phpunit/ src/ Rules/ PHPUnit/ ShouldCallParentMethodsRule.php, line 71
Class
- ShouldCallParentMethodsRule
- @implements Rule<InClassMethodNode>
Namespace
PHPStan\Rules\PHPUnitCode
private function hasParentClassCall(?array $stmts, string $methodName) : bool {
if ($stmts === null) {
return false;
}
foreach ($stmts as $stmt) {
if (!$stmt instanceof Node\Stmt\Expression) {
continue;
}
if (!$stmt->expr instanceof Node\Expr\StaticCall) {
continue;
}
if (!$stmt->expr->class instanceof Node\Name) {
continue;
}
$class = (string) $stmt->expr->class;
if (strtolower($class) !== 'parent') {
continue;
}
if (!$stmt->expr->name instanceof Node\Identifier) {
continue;
}
if ($stmt->expr->name
->toLowerString() === $methodName) {
return true;
}
}
return false;
}