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

Breadcrumb

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

function IgnoreDeprecationsScope::isScopeDeprecated

Overrides DeprecatedScopeResolver::isScopeDeprecated

File

vendor/mglaman/phpstan-drupal/src/DeprecatedScope/IgnoreDeprecationsScope.php, line 14

Class

IgnoreDeprecationsScope

Namespace

mglaman\PHPStanDrupal\DeprecatedScope

Code

public function isScopeDeprecated(Scope $scope) : bool {
    if (!class_exists(IgnoreDeprecations::class)) {
        return false;
    }
    if ($scope->isInClass()) {
        $class = $scope->getClassReflection()
            ->getNativeReflection();
        if ($class->getAttributes(IgnoreDeprecations::class) !== []) {
            return true;
        }
        $function = $scope->getFunction();
        if ($function === null) {
            return false;
        }
        $method = $class->getMethod($function->getName());
        if ($method->getAttributes(IgnoreDeprecations::class) !== []) {
            return true;
        }
    }
    return false;
}
RSS feed
Powered by Drupal