@@ -83,6 +83,7 @@ public function __construct(
8383 private readonly ObjectTypeSpecifier $ objectTypeSpecifier ,
8484 private readonly ClassAnalyzer $ classAnalyzer ,
8585 private readonly GenericClassStringTypeCorrector $ genericClassStringTypeCorrector ,
86+ private readonly NodeTypeCorrector $ nodeTypeCorrector ,
8687 private readonly ReflectionProvider $ reflectionProvider ,
8788 private readonly AccessoryNonEmptyStringTypeCorrector $ accessoryNonEmptyStringTypeCorrector ,
8889 private readonly AccessoryNonEmptyArrayTypeCorrector $ accessoryNonEmptyArrayTypeCorrector ,
@@ -203,7 +204,7 @@ public function getType(Node $node): Type
203204 $ type = $ this ->resolveByNodeTypeResolvers ($ node );
204205
205206 if ($ type instanceof Type) {
206- $ type = $ this ->correctType ($ type );
207+ $ type = $ this ->nodeTypeCorrector -> correctType ($ type );
207208
208209 if ($ type instanceof ObjectType) {
209210 $ scope = $ node ->getAttribute (AttributeKey::SCOPE );
@@ -238,7 +239,7 @@ public function getType(Node $node): Type
238239 return new MixedType ();
239240 }
240241
241- $ type = $ this ->correctType ($ scope ->getType ($ node ));
242+ $ type = $ this ->nodeTypeCorrector -> correctType ($ scope ->getType ($ node ));
242243
243244 // hot fix for phpstan not resolving chain method calls
244245 if (! $ node instanceof MethodCall) {
@@ -286,7 +287,7 @@ public function getNativeType(Expr $expr): Type
286287 return new ObjectWithoutClassType ();
287288 }
288289
289- return $ this ->correctType ($ type );
290+ return $ this ->nodeTypeCorrector -> correctType ($ type );
290291 }
291292
292293 return $ this ->resolveNativeUnionType ($ type );
@@ -374,16 +375,6 @@ public function isMethodStaticCallOrClassMethodObjectType(Node $node, ObjectType
374375 return $ classReflection ->hasTraitUse ($ objectType ->getClassName ());
375376 }
376377
377- private function correctType (Type $ type ): Type
378- {
379- $ type = $ this ->accessoryNonEmptyStringTypeCorrector ->correct ($ type );
380- $ type = $ this ->genericClassStringTypeCorrector ->correct ($ type );
381-
382- $ type = $ this ->cleanArrayIntersectionType ($ type );
383-
384- return $ this ->accessoryNonEmptyArrayTypeCorrector ->correct ($ type );
385- }
386-
387378 /**
388379 * Allow pull type from
389380 *
@@ -680,25 +671,25 @@ private function isSubstrOnPHP74(FuncCall $funcCall): bool
680671 return ! $ this ->phpVersionProvider ->isAtLeastPhpVersion (PhpVersion::PHP_80 );
681672 }
682673
683- private function cleanArrayIntersectionType (Type $ type ): Type
684- {
685- if (! $ type instanceof IntersectionType) {
686- return $ type ;
687- }
688-
689- $ cleanTypes = [];
690- foreach ($ type ->getTypes () as $ intersectionType ) {
691- if ($ intersectionType instanceof AccessoryArrayListType) {
692- continue ;
693- }
694-
695- $ cleanTypes [] = $ intersectionType ;
696- }
697-
698- if (count ($ cleanTypes ) === 1 ) {
699- return $ cleanTypes [0 ];
700- }
701-
702- return new IntersectionType ($ cleanTypes );
703- }
674+ // private function cleanArrayIntersectionType(Type $type): Type
675+ // {
676+ // if (! $type instanceof IntersectionType) {
677+ // return $type;
678+ // }
679+ //
680+ // $cleanTypes = [];
681+ // foreach ($type->getTypes() as $intersectionType) {
682+ // if ($intersectionType instanceof AccessoryArrayListType) {
683+ // continue;
684+ // }
685+ //
686+ // $cleanTypes[] = $intersectionType;
687+ // }
688+ //
689+ // if (count($cleanTypes) === 1) {
690+ // return $cleanTypes[0];
691+ // }
692+ //
693+ // return new IntersectionType($cleanTypes);
694+ // }
704695}
0 commit comments