We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5155bfa commit c29f771Copy full SHA for c29f771
rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php
@@ -107,15 +107,9 @@ public function refactor(Node $node): ?Node
107
private function isPossiblyStringType(Expr $expr): bool
108
{
109
$exprType = $this->getType($expr);
110
+ $exprType = \PHPStan\Type\TypeCombinator::removeNull($exprType);
111
+ $exprType = \PHPStan\Type\TypeCombinator::removeFalsey($exprType);
112
- if ($exprType instanceof UnionType) {
- foreach ($exprType->getTypes() as $unionedType) {
113
- if ($unionedType instanceof StringType) {
114
- return true;
115
- }
116
117
118
-
119
- return $exprType instanceof StringType;
+ return $exprType->isString()->yes();
120
}
121
0 commit comments