3131use PHPStan \Type \CallableType ;
3232use PHPStan \Type \Constant \ConstantArrayTypeBuilder ;
3333use PHPStan \Type \Constant \ConstantIntegerType ;
34- use PHPStan \Type \Generic \TemplateType ;
3534use PHPStan \Type \Generic \TemplateTypeMap ;
3635use PHPStan \Type \Generic \TemplateTypeVarianceMap ;
3736use PHPStan \Type \IntegerType ;
3837use PHPStan \Type \IntersectionType ;
39- use PHPStan \Type \LateResolvableType ;
4038use PHPStan \Type \MixedType ;
4139use PHPStan \Type \NullType ;
4240use PHPStan \Type \ObjectType ;
4341use PHPStan \Type \ResourceType ;
4442use PHPStan \Type \StringType ;
4543use PHPStan \Type \Type ;
4644use PHPStan \Type \TypeCombinator ;
47- use PHPStan \Type \TypeTraverser ;
4845use PHPStan \Type \UnionType ;
4946use function array_is_list ;
5047use function array_key_exists ;
@@ -563,28 +560,28 @@ public static function selectFromArgs(
563560
564561 private static function hasAcceptorTemplateOrLateResolvableType (ParametersAcceptor $ acceptor ): bool
565562 {
566- if (self :: hasTemplateOrLateResolvableType ( $ acceptor ->getReturnType ())) {
563+ if ($ acceptor ->getReturnType ()-> hasTemplateOrLateResolvableType ( )) {
567564 return true ;
568565 }
569566
570567 foreach ($ acceptor ->getParameters () as $ parameter ) {
571568 if (
572569 $ parameter instanceof ExtendedParameterReflection
573570 && $ parameter ->getOutType () !== null
574- && self :: hasTemplateOrLateResolvableType ( $ parameter ->getOutType ())
571+ && $ parameter ->getOutType ()-> hasTemplateOrLateResolvableType ( )
575572 ) {
576573 return true ;
577574 }
578575
579576 if (
580577 $ parameter instanceof ExtendedParameterReflection
581578 && $ parameter ->getClosureThisType () !== null
582- && self :: hasTemplateOrLateResolvableType ( $ parameter ->getClosureThisType ())
579+ && $ parameter ->getClosureThisType ()-> hasTemplateOrLateResolvableType ( )
583580 ) {
584581 return true ;
585582 }
586583
587- if (!self :: hasTemplateOrLateResolvableType ( $ parameter ->getType ())) {
584+ if (!$ parameter ->getType ()-> hasTemplateOrLateResolvableType ( )) {
588585 continue ;
589586 }
590587
@@ -594,20 +591,6 @@ private static function hasAcceptorTemplateOrLateResolvableType(ParametersAccept
594591 return false ;
595592 }
596593
597- private static function hasTemplateOrLateResolvableType (Type $ type ): bool
598- {
599- $ has = false ;
600- TypeTraverser::map ($ type , static function (Type $ type , callable $ traverse ) use (&$ has ): Type {
601- if ($ type instanceof TemplateType || $ type instanceof LateResolvableType) {
602- $ has = true ;
603- }
604-
605- return $ has ? $ type : $ traverse ($ type );
606- });
607-
608- return $ has ;
609- }
610-
611594 /**
612595 * @param array<int|string, Type> $types
613596 * @param ParametersAcceptor[] $parametersAcceptors
0 commit comments