99use PHPStan \Rules \Rule ;
1010use PHPStan \Rules \RuleErrorBuilder ;
1111use function sprintf ;
12- use const PHP_VERSION_ID ;
1312
1413/**
1514 * @implements Rule<ConstFetch>
@@ -23,19 +22,10 @@ class FetchingDeprecatedConstRule implements Rule
2322 /** @var DeprecatedScopeHelper */
2423 private $ deprecatedScopeHelper ;
2524
26- /** @var array<string,string> */
27- private $ deprecatedConstants = [];
28-
2925 public function __construct (ReflectionProvider $ reflectionProvider , DeprecatedScopeHelper $ deprecatedScopeHelper )
3026 {
3127 $ this ->reflectionProvider = $ reflectionProvider ;
3228 $ this ->deprecatedScopeHelper = $ deprecatedScopeHelper ;
33-
34- // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
35- if (PHP_VERSION_ID >= 70300 ) {
36- $ this ->deprecatedConstants ['FILTER_FLAG_SCHEME_REQUIRED ' ] = 'Use of constant %s is deprecated since PHP 7.3. ' ;
37- $ this ->deprecatedConstants ['FILTER_FLAG_HOST_REQUIRED ' ] = 'Use of constant %s is deprecated since PHP 7.3. ' ;
38- }
3929 }
4030
4131 public function getNodeType (): string
@@ -64,15 +54,6 @@ public function processNode(Node $node, Scope $scope): array
6454 ];
6555 }
6656
67- if (isset ($ this ->deprecatedConstants [$ constantReflection ->getName ()])) {
68- return [
69- RuleErrorBuilder::message (sprintf (
70- $ this ->deprecatedConstants [$ constantReflection ->getName ()],
71- $ constantReflection ->getName ()
72- ))->identifier ('constant.deprecated ' )->build (),
73- ];
74- }
75-
7657 return [];
7758 }
7859
0 commit comments