diff --git a/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector/Fixture/skip_possible_array.php.inc b/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector/Fixture/skip_possible_array.php.inc new file mode 100644 index 00000000000..d77736a6b58 --- /dev/null +++ b/rules-tests/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector/Fixture/skip_possible_array.php.inc @@ -0,0 +1,13 @@ +nodeTypeResolver->getNativeType($variableConcattedFromParam); + if (! $nativeType instanceof MixedType) { + continue; + } - if ($nativeType instanceof MixedType && $nativeType->getSubtractedType() instanceof Type && TypeCombinator::containsNull( - $nativeType->getSubtractedType() - )) { - $param->type = new NullableType(new Identifier('string')); - } else { + $subtractedType = $nativeType->getSubtractedType(); + if (! $subtractedType instanceof Type) { $param->type = new Identifier('string'); + $hasChanged = true; + + continue; } - $hasChanged = true; + if (TypeCombinator::containsNull($subtractedType)) { + $param->type = new NullableType(new Identifier('string')); + $hasChanged = true; + } } if ($hasChanged) {