Skip to content

Commit c1da4ec

Browse files
authored
[Variables] Fetch list super global variable names from PHPStan Scope::SUPERGLOBAL_VARIABLES constant (#7663)
1 parent 89b8e07 commit c1da4ec

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/Php/ReservedKeywordAnalyzer.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,12 @@
44

55
namespace Rector\Php;
66

7+
use PHPStan\Analyser\Scope;
8+
79
final class ReservedKeywordAnalyzer
810
{
9-
/**
10-
* @var string[]
11-
*/
12-
private const NATIVE_VARIABLE_NAMES = [
13-
'_ENV',
14-
'_POST',
15-
'_GET',
16-
'_COOKIE',
17-
'_SERVER',
18-
'_FILES',
19-
'_REQUEST',
20-
'_SESSION',
21-
'GLOBALS',
22-
];
23-
2411
public function isNativeVariable(string $name): bool
2512
{
26-
return in_array($name, self::NATIVE_VARIABLE_NAMES, true);
13+
return in_array($name, Scope::SUPERGLOBAL_VARIABLES, true);
2714
}
2815
}

0 commit comments

Comments
 (0)