88use PhpParser \Node \Name ;
99use PHPStan \Reflection \Native \NativeParameterReflection ;
1010use PHPStan \Reflection \Php \DummyParameter ;
11+ use PHPStan \Reflection \Php \ExtendedDummyParameter ;
1112use PHPStan \Testing \PHPStanTestCase ;
1213use PHPStan \Type \Accessory \AccessoryNonEmptyStringType ;
1314use PHPStan \Type \ArrayType ;
1415use PHPStan \Type \Constant \ConstantBooleanType ;
1516use PHPStan \Type \Constant \ConstantIntegerType ;
1617use PHPStan \Type \FloatType ;
1718use PHPStan \Type \Generic \TemplateTypeFactory ;
19+ use PHPStan \Type \Generic \TemplateTypeHelper ;
1820use PHPStan \Type \Generic \TemplateTypeMap ;
1921use PHPStan \Type \Generic \TemplateTypeScope ;
2022use PHPStan \Type \Generic \TemplateTypeVariance ;
23+ use PHPStan \Type \Generic \TemplateTypeVarianceMap ;
2124use PHPStan \Type \IntegerType ;
2225use PHPStan \Type \IntersectionType ;
2326use PHPStan \Type \MixedType ;
2831use PHPStan \Type \Type ;
2932use PHPStan \Type \UnionType ;
3033use PHPStan \Type \VerbosityLevel ;
34+ use PHPStan \Type \VoidType ;
3135use PHPUnit \Framework \Attributes \DataProvider ;
36+ use function array_map ;
3237use function count ;
3338
3439class ParametersAcceptorSelectorTest extends PHPStanTestCase
@@ -69,7 +74,27 @@ public static function dataSelectFromTypes(): Generator
6974],
7075$ datePeriodConstructorVariants ,
7176false ,
72- $ datePeriodConstructorVariants [0 ],
77+ new FunctionVariant (
78+ TemplateTypeMap::createEmpty (),
79+ TemplateTypeMap::createEmpty (),
80+ array_map (static fn ($ parameter ) => new ExtendedDummyParameter (
81+ $ parameter ->getName (),
82+ TemplateTypeHelper::resolveToBounds ($ parameter ->getType ()),
83+ $ parameter ->isOptional (),
84+ $ parameter ->passedByReference (),
85+ $ parameter ->isVariadic (),
86+ $ parameter ->getDefaultValue (),
87+ $ parameter ->getNativeType (),
88+ $ parameter ->getPhpDocType (),
89+ $ parameter ->getOutType (),
90+ $ parameter ->isImmediatelyInvokedCallable (),
91+ $ parameter ->getClosureThisType (),
92+ $ parameter ->getAttributes (),
93+ ), $ datePeriodConstructorVariants [0 ]->getParameters ()),
94+ false ,
95+ new VoidType (),
96+ TemplateTypeVarianceMap::createEmpty (),
97+ ),
7398];
7499yield [
75100[
@@ -80,7 +105,27 @@ public static function dataSelectFromTypes(): Generator
80105],
81106$ datePeriodConstructorVariants ,
82107false ,
83- $ datePeriodConstructorVariants [1 ],
108+ new FunctionVariant (
109+ TemplateTypeMap::createEmpty (),
110+ TemplateTypeMap::createEmpty (),
111+ array_map (static fn ($ parameter ) => new ExtendedDummyParameter (
112+ $ parameter ->getName (),
113+ TemplateTypeHelper::resolveToBounds ($ parameter ->getType ()),
114+ $ parameter ->isOptional (),
115+ $ parameter ->passedByReference (),
116+ $ parameter ->isVariadic (),
117+ $ parameter ->getDefaultValue (),
118+ $ parameter ->getNativeType (),
119+ $ parameter ->getPhpDocType (),
120+ $ parameter ->getOutType (),
121+ $ parameter ->isImmediatelyInvokedCallable (),
122+ $ parameter ->getClosureThisType (),
123+ $ parameter ->getAttributes (),
124+ ), $ datePeriodConstructorVariants [1 ]->getParameters ()),
125+ false ,
126+ new VoidType (),
127+ TemplateTypeVarianceMap::createEmpty (),
128+ ),
84129];
85130yield [
86131[
0 commit comments