Skip to content

Commit c29f771

Browse files
committed
Fix
1 parent 5155bfa commit c29f771

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,9 @@ public function refactor(Node $node): ?Node
107107
private function isPossiblyStringType(Expr $expr): bool
108108
{
109109
$exprType = $this->getType($expr);
110+
$exprType = \PHPStan\Type\TypeCombinator::removeNull($exprType);
111+
$exprType = \PHPStan\Type\TypeCombinator::removeFalsey($exprType);
110112

111-
if ($exprType instanceof UnionType) {
112-
foreach ($exprType->getTypes() as $unionedType) {
113-
if ($unionedType instanceof StringType) {
114-
return true;
115-
}
116-
}
117-
}
118-
119-
return $exprType instanceof StringType;
113+
return $exprType->isString()->yes();
120114
}
121115
}

0 commit comments

Comments
 (0)