@@ -40,10 +40,7 @@ public function getPrintfPlaceholderAcceptingTypes(string $format): array
4040 {
4141 $ placeholders = $ this ->parsePlaceholders (self ::PRINTF_SPECIFIER_PATTERN , $ format );
4242 $ result = [];
43- // int can go into float, string and mixed as well.
44- // float can't go into int, but it can go to string/mixed.
45- // string can go into mixed, but not into int/float.
46- // mixed can only go into mixed.
43+ // Type on the left can go to the type on the right, but not vice versa.
4744 $ typeSequenceMap = array_flip (['int ' , 'float ' , 'string ' , 'mixed ' ]);
4845
4946 foreach ($ placeholders as $ position => $ types ) {
@@ -67,11 +64,10 @@ static function (Type $t) use ($types): bool {
6764 foreach ($ types as $ acceptingType ) {
6865 $ subresult = match ($ acceptingType ) {
6966 'strict-int ' => (new IntegerType ())->accepts ($ t , true )->yes (),
70- // This allows float, constant non-numeric string, ...
7167 'int ' => ! $ t ->toInteger () instanceof ErrorType,
7268 'float ' => ! $ t ->toFloat () instanceof ErrorType,
7369 // The function signature already limits the parameters to stringable types, so there's
74- // no point in checking it again here.
70+ // no point in checking string again here.
7571 'string ' , 'mixed ' => true ,
7672 };
7773
0 commit comments