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

Breadcrumb

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

function FetchingDeprecatedConstRule::processNode

File

vendor/phpstan/phpstan-deprecation-rules/src/Rules/Deprecations/FetchingDeprecatedConstRule.php, line 36

Class

FetchingDeprecatedConstRule
@implements Rule<ConstFetch>

Namespace

PHPStan\Rules\Deprecations

Code

public function processNode(Node $node, Scope $scope) : array {
    if ($this->deprecatedScopeHelper
        ->isScopeDeprecated($scope)) {
        return [];
    }
    if (!$this->reflectionProvider
        ->hasConstant($node->name, $scope)) {
        return [];
    }
    $constantReflection = $this->reflectionProvider
        ->getConstant($node->name, $scope);
    if ($constantReflection->isDeprecated()
        ->yes()) {
        return [
            RuleErrorBuilder::message(sprintf($constantReflection->getDeprecatedDescription() ?? 'Use of constant %s is deprecated.', $constantReflection->getName()))
                ->identifier('constant.deprecated')
                ->build(),
        ];
    }
    return [];
}

API Navigation

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