@@ -177,15 +177,17 @@ private function refactorClassMethod(Class_ $class): ?Class_
177177 /** @var string $parameterName */
178178 $ parameterName = $ this ->getName ($ param );
179179
180- $ this ->phpDocTypeChanger ->changeParamType (
180+ $ hasChangedParamType = $ this ->phpDocTypeChanger ->changeParamType (
181181 $ classMethod ,
182182 $ phpDocInfo ,
183183 $ collectionObjectType ,
184184 $ param ,
185185 $ parameterName
186186 );
187187
188- $ hasChanged = true ;
188+ if ($ hasChangedParamType ) {
189+ $ hasChanged = true ;
190+ }
189191 }
190192
191193 if ($ hasChanged ) {
@@ -213,7 +215,7 @@ private function refactorPropertyPhpDocInfo(Property $property, PhpDocInfo $phpD
213215 $ this ->collectionTypeResolver ->hasIndexBy ($ property ),
214216 $ property
215217 );
216- $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ newVarType );
218+ $ hasChanged = $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ newVarType );
217219 } else {
218220 $ collectionObjectType = $ this ->collectionTypeResolver ->resolveFromToManyProperty ($ property );
219221 if (! $ collectionObjectType instanceof FullyQualifiedObjectType) {
@@ -225,7 +227,11 @@ private function refactorPropertyPhpDocInfo(Property $property, PhpDocInfo $phpD
225227 $ this ->collectionTypeResolver ->hasIndexBy ($ property ),
226228 $ property
227229 );
228- $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ newVarType );
230+ $ hasChanged = $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ newVarType );
231+ }
232+
233+ if (!$ hasChanged ) {
234+ return null ;
229235 }
230236
231237 return $ property ;
@@ -262,7 +268,11 @@ private function refactorAttribute(Expr $expr, PhpDocInfo $phpDocInfo, Property
262268 $ this ->collectionTypeResolver ->hasIndexBy ($ property ),
263269 $ property
264270 );
265- $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ genericObjectType );
271+ $ hasChanged = $ this ->phpDocTypeChanger ->changeVarType ($ property , $ phpDocInfo , $ genericObjectType );
272+
273+ if (! $ hasChanged ) {
274+ return null ;
275+ }
266276
267277 return $ property ;
268278 }
0 commit comments