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

Breadcrumb

  1. Drupal Core 11.1.x

IgnoreDeprecationsScope.php

Namespace

mglaman\PHPStanDrupal\DeprecatedScope

File

vendor/mglaman/phpstan-drupal/src/DeprecatedScope/IgnoreDeprecationsScope.php

View source
<?php

declare (strict_types=1);
namespace mglaman\PHPStanDrupal\DeprecatedScope;

use PHPStan\Analyser\Scope;
use PHPStan\Rules\Deprecations\DeprecatedScopeResolver;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
final class IgnoreDeprecationsScope implements DeprecatedScopeResolver {
    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;
    }

}

Classes

Title Deprecated Summary
IgnoreDeprecationsScope

API Navigation

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