Skip to content

Commit 3c0a8f0

Browse files
committed
refactor new usages to methods
1 parent 58f3ff6 commit 3c0a8f0

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

src/Reflection/InitializerExprTypeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ private function getFiniteOrConstantScalarTypes(Type $leftType, Type $rightType,
11571157

11581158
public function getBitwiseXorTypeFromTypes(Type $leftType, Type $rightType): Type
11591159
{
1160-
if ($leftType instanceof NeverType || $rightType instanceof NeverType) {
1160+
if ($leftType->isNever()->or($rightType->isNever())->yes()) {
11611161
return $this->getNeverType($leftType, $rightType);
11621162
}
11631163

src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use PHPStan\Rules\Rule;
1414
use PHPStan\Rules\RuleErrorBuilder;
1515
use PHPStan\Type\Constant\ConstantBooleanType;
16-
use PHPStan\Type\NeverType;
1716

1817
/**
1918
* @implements Rule<BreaklessWhileLoopNode>
@@ -75,7 +74,7 @@ public function processNode(
7574

7675
$ref = $scope->getFunction() ?? $scope->getAnonymousFunctionReflection();
7776

78-
if ($ref !== null && $ref->getReturnType() instanceof NeverType) {
77+
if ($ref !== null && $ref->getReturnType()->isNever()->yes()) {
7978
return [];
8079
}
8180

src/Type/Php/ArrayCountValuesDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use PHPStan\Type\IntegerRangeType;
1414
use PHPStan\Type\IntegerType;
1515
use PHPStan\Type\IntersectionType;
16-
use PHPStan\Type\NeverType;
1716
use PHPStan\Type\StringType;
1817
use PHPStan\Type\Type;
1918
use PHPStan\Type\TypeCombinator;
@@ -51,7 +50,7 @@ public function getTypeFromFunctionCall(
5150

5251
foreach ($arrayTypes as $arrayType) {
5352
$itemType = TypeCombinator::intersect($arrayType->getItemType(), $allowedValues);
54-
if ($itemType instanceof NeverType) {
53+
if ($itemType->isNever()->yes()) {
5554
continue;
5655
}
5756

src/Type/TypeCombinator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static function union(Type ...$types): Type
167167
) {
168168
return $types[$i];
169169
}
170-
if ($types[$i] instanceof NeverType && !$types[$i]->isExplicit()) {
170+
if ($types[$i]->isNever()->yes() && $types[$i]->isExplicitNever()->no()) {
171171
array_splice($types, $i--, 1);
172172
$typesCount--;
173173
continue;
@@ -1137,7 +1137,7 @@ public static function intersect(Type ...$types): Type
11371137
}
11381138

11391139
foreach ($types as $type) {
1140-
if ($type instanceof NeverType && !$type->isExplicit()) {
1140+
if ($type->isNever()->yes() && $type->isExplicitNever()->no()) {
11411141
return $type;
11421142
}
11431143
}

0 commit comments

Comments
 (0)