Skip to content

Commit 0da3135

Browse files
committed
Scope: fix getPhpVersion() in non-namespaced files
1 parent 2d637da commit 0da3135

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5727,15 +5727,15 @@ public function getIterableValueType(Type $iteratee): Type
57275727

57285728
public function getPhpVersion(): PhpVersions
57295729
{
5730-
$versionExpr = new ConstFetch(new Name('PHP_VERSION_ID'));
5731-
if (!$this->hasExpressionType($versionExpr)->yes()) {
5730+
$name = new Name('PHP_VERSION_ID');
5731+
if (!$this->hasConstant($name)) {
57325732
if (is_array($this->configPhpVersion)) {
57335733
return new PhpVersions(IntegerRangeType::fromInterval($this->configPhpVersion['min'], $this->configPhpVersion['max']));
57345734
}
57355735
return new PhpVersions(new ConstantIntegerType($this->phpVersion->getVersionId()));
57365736
}
57375737

5738-
return new PhpVersions($this->getType($versionExpr));
5738+
return new PhpVersions($this->getType(new ConstFetch($name)));
57395739
}
57405740

57415741
}

0 commit comments

Comments
 (0)