Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ShouldCallParentMethodsRule.php

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\PHPUnit

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal