@@ -40,10 +40,7 @@ public function getPrintfPlaceholderAcceptingTypes(string $format): array
40
40
{
41
41
$ placeholders = $ this ->parsePlaceholders (self ::PRINTF_SPECIFIER_PATTERN , $ format );
42
42
$ 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.
47
44
$ typeSequenceMap = array_flip (['int ' , 'float ' , 'string ' , 'mixed ' ]);
48
45
49
46
foreach ($ placeholders as $ position => $ types ) {
@@ -67,11 +64,10 @@ static function (Type $t) use ($types): bool {
67
64
foreach ($ types as $ acceptingType ) {
68
65
$ subresult = match ($ acceptingType ) {
69
66
'strict-int ' => (new IntegerType ())->accepts ($ t , true )->yes (),
70
- // This allows float, constant non-numeric string, ...
71
67
'int ' => ! $ t ->toInteger () instanceof ErrorType,
72
68
'float ' => ! $ t ->toFloat () instanceof ErrorType,
73
69
// 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.
75
71
'string ' , 'mixed ' => true ,
76
72
};
77
73
0 commit comments