Skip to content

Commit dedde46

Browse files
committed
fix
1 parent f118b55 commit dedde46

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/Analyser/MutatingScope.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5723,9 +5723,14 @@ public function getIterableValueType(Type $iteratee): Type
57235723
return $iteratee->getIterableValueType();
57245724
}
57255725

5726-
public function getPhpVersions(): PhpVersions
5726+
public function getPhpVersion(): PhpVersions
57275727
{
5728-
$versionId = $this->getType(new ConstFetch(new Name('PHP_VERSION_ID')));
5728+
$versionExpr = new ConstFetch(new Name('PHP_VERSION_ID'));
5729+
if (!$this->hasExpressionType($versionExpr)->yes()) {
5730+
return new PhpVersions([$this->phpVersion->getVersionId()]);
5731+
}
5732+
5733+
$versionId = $this->getType($versionExpr);
57295734
if ($versionId instanceof IntegerRangeType) {
57305735
if ($versionId->getMin() !== null && $versionId->getMax() !== null) {
57315736
return new PhpVersions([$versionId->getMin(), $versionId->getMax()]);

src/Analyser/Scope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ public function filterByFalseyValue(Expr $expr): self;
137137

138138
public function isInFirstLevelStatement(): bool;
139139

140-
public function getPhpVersions(): PhpVersions;
140+
public function getPhpVersion(): PhpVersions;
141141

142142
}

src/Php/PhpVersion.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ public function supportsPassNoneEncodings(): bool
248248
return $this->versionId < 70300;
249249
}
250250

251-
/**
252-
* @deprecated use PhpVersions::producesWarningForFinalPrivateMethods() instead
253-
*/
254251
public function producesWarningForFinalPrivateMethods(): bool
255252
{
256253
return $this->versionId >= 80000;

src/Php/PhpVersions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ final class PhpVersions
1818
private int $maxVersionId;
1919

2020
/**
21-
* @api
2221
* @param list<int> $phpVersionIds
2322
*/
2423
public function __construct(

src/Rules/Methods/FinalPrivateMethodRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getNodeType(): string
2121
public function processNode(Node $node, Scope $scope): array
2222
{
2323
$method = $node->getMethodReflection();
24-
if ($scope->getPhpVersions()->producesWarningForFinalPrivateMethods()->no()) {
24+
if ($scope->getPhpVersion()->producesWarningForFinalPrivateMethods()->no()) {
2525
return [];
2626
}
2727

0 commit comments

Comments
 (0)