From 92ad9d2026d940cf57f23607d26f4be7714128ac Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 25 Nov 2024 13:22:10 +0100 Subject: [PATCH] Scope: fix getPhpVersion() in non-namespaced files --- src/Analyser/MutatingScope.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index 832c73b1c0..b7a2bacd93 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -5728,15 +5728,15 @@ public function getIterableValueType(Type $iteratee): Type public function getPhpVersion(): PhpVersions { - $versionExpr = new ConstFetch(new Name('PHP_VERSION_ID')); - if (!$this->hasExpressionType($versionExpr)->yes()) { + $name = new Name('PHP_VERSION_ID'); + if (!$this->hasConstant($name)) { if (is_array($this->configPhpVersion)) { return new PhpVersions(IntegerRangeType::fromInterval($this->configPhpVersion['min'], $this->configPhpVersion['max'])); } return new PhpVersions(new ConstantIntegerType($this->phpVersion->getVersionId())); } - return new PhpVersions($this->getType($versionExpr)); + return new PhpVersions($this->getType(new ConstFetch($name))); } }