Skip to content

Commit ab9ecd3

Browse files
Rework
1 parent f81e0d2 commit ab9ecd3

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

src/Type/Php/MbConvertEncodingFunctionReturnTypeExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,35 @@ public function getTypeFromFunctionCall(
6161
}
6262
$fromEncodingArgType = $scope->getType($functionCall->getArgs()[2]->value);
6363

64-
$mayNotDetectEncoding = false;
64+
$returnFalseIfCannotDetectEncoding = false;
6565
if (!$fromEncodingArgType->isArray()->no()) {
6666
$constantArrays = $fromEncodingArgType->getConstantArrays();
6767
if (count($constantArrays) > 0) {
6868
foreach ($constantArrays as $constantArray) {
6969
if (count($constantArray->getValueTypes()) > 1) {
70-
$mayNotDetectEncoding = true;
70+
$returnFalseIfCannotDetectEncoding = true;
7171
break;
7272
}
7373
}
7474
} else {
75-
$mayNotDetectEncoding = true;
75+
$returnFalseIfCannotDetectEncoding = true;
7676
}
7777
}
78-
if (!$mayNotDetectEncoding && !$fromEncodingArgType->isString()->no()) {
78+
if (!$returnFalseIfCannotDetectEncoding && !$fromEncodingArgType->isString()->no()) {
7979
$constantStrings = $fromEncodingArgType->getConstantStrings();
8080
if (count($constantStrings) > 0) {
8181
foreach ($constantStrings as $constantString) {
8282
if (str_contains($constantString->getValue(), ',')) {
83-
$mayNotDetectEncoding = true;
83+
$returnFalseIfCannotDetectEncoding = true;
8484
break;
8585
}
8686
}
8787
} else {
88-
$mayNotDetectEncoding = true;
88+
$returnFalseIfCannotDetectEncoding = true;
8989
}
9090
}
9191

92-
if (!$mayNotDetectEncoding) {
92+
if (!$returnFalseIfCannotDetectEncoding) {
9393
return $result;
9494
}
9595
}

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ private static function findTestFiles(): iterable
5757
yield __DIR__ . '/data/explode-php80.php';
5858
}
5959

60-
if (PHP_VERSION_ID < 80000) {
61-
yield __DIR__ . '/data/mb-convert-encoding-php7.php';
62-
} else {
63-
yield __DIR__ . '/data/mb-convert-encoding-php8.php';
64-
}
65-
6660
if (PHP_VERSION_ID >= 80000) {
6761
yield __DIR__ . '/../Reflection/data/unionTypes.php';
6862
yield __DIR__ . '/../Reflection/data/mixedType.php';

tests/PHPStan/Analyser/data/mb-convert-encoding-php7.php renamed to tests/PHPStan/Analyser/nsrt/mb-convert-encoding-php7.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint <= 8.0
22

33
namespace MbConvertEncodingPHP7;
44

tests/PHPStan/Analyser/data/mb-convert-encoding-php8.php renamed to tests/PHPStan/Analyser/nsrt/mb-convert-encoding-php8.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint >= 8.0
22

33
namespace MbConvertEncodingPHP8;
44

0 commit comments

Comments
 (0)