@@ -42,10 +42,7 @@ public function getPrintfPlaceholderAcceptingTypes(string $format): array
42
42
{
43
43
$ placeholders = $ this ->parsePlaceholders (self ::PRINTF_SPECIFIER_PATTERN , $ format );
44
44
$ result = [];
45
- // int can go into float, string and mixed as well.
46
- // float can't go into int, but it can go to string/mixed.
47
- // string can go into mixed, but not into int/float.
48
- // mixed can only go into mixed.
45
+ // Type on the left can go to the type on the right, but not vice versa.
49
46
$ typeSequenceMap = array_flip (['int ' , 'float ' , 'string ' , 'mixed ' ]);
50
47
51
48
foreach ($ placeholders as $ position => $ types ) {
@@ -69,11 +66,10 @@ static function (Type $t) use ($types): bool {
69
66
foreach ($ types as $ acceptingType ) {
70
67
$ subresult = match ($ acceptingType ) {
71
68
'strict-int ' => (new IntegerType ())->accepts ($ t , true )->yes (),
72
- // This allows float, constant non-numeric string, ...
73
69
'int ' => ! $ t ->toInteger () instanceof ErrorType,
74
70
'float ' => ! $ t ->toFloat () instanceof ErrorType,
75
71
// The function signature already limits the parameters to stringable types, so there's
76
- // no point in checking it again here.
72
+ // no point in checking string again here.
77
73
'string ' , 'mixed ' => true ,
78
74
};
79
75
0 commit comments