55use  PhpParser \Node \Expr \MethodCall ;
66use  PHPStan \Analyser \Scope ;
77use  PHPStan \Reflection \MethodReflection ;
8+ use  PHPStan \Type \Accessory \AccessoryArrayListType ;
89use  PHPStan \Type \ArrayType ;
910use  PHPStan \Type \Constant \ConstantStringType ;
1011use  PHPStan \Type \DynamicMethodReturnTypeExtension ;
11- use  PHPStan \Type \MixedType ;
12+ use  PHPStan \Type \Generic \GenericClassStringType ;
13+ use  PHPStan \Type \IntegerType ;
1214use  PHPStan \Type \ObjectType ;
1315use  PHPStan \Type \Type ;
1416use  function  count ;
@@ -33,15 +35,18 @@ public function getTypeFromMethodCall(
3335	): Type 
3436	{
3537		if  (count ($ methodCall ->getArgs ()) === 0 ) {
36- 			return  new  ArrayType (new  MixedType (), new  ArrayType (new  MixedType (), new  ObjectType ('Symfony\Component\Messenger\Stamp\StampInterface ' )));
38+ 			return  new  ArrayType (
39+ 				new  GenericClassStringType (new  ObjectType ('Symfony\Component\Messenger\Stamp\StampInterface ' )),
40+ 				AccessoryArrayListType::intersectWith (new  ArrayType (new  IntegerType (), new  ObjectType ('Symfony\Component\Messenger\Stamp\StampInterface ' )))
41+ 			);
3742		}
3843
3944		$ argType  = $ scope ->getType ($ methodCall ->getArgs ()[0 ]->value );
4045		if  (!$ argType  instanceof  ConstantStringType) {
41- 			return  new  ArrayType (new  MixedType (), new  ObjectType ('Symfony\Component\Messenger\Stamp\StampInterface ' ));
46+ 			return  AccessoryArrayListType:: intersectWith ( new  ArrayType (new  IntegerType (), new  ObjectType ('Symfony\Component\Messenger\Stamp\StampInterface ' ) ));
4247		}
4348
44- 		return  new  ArrayType (new  MixedType (), new  ObjectType ($ argType ->getValue ()));
49+ 		return  AccessoryArrayListType:: intersectWith ( new  ArrayType (new  IntegerType (), new  ObjectType ($ argType ->getValue () )));
4550	}
4651
4752}
0 commit comments