@@ -116,19 +116,16 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
116
116
$ placeholders = array_filter ($ matches , static fn (array $ match ): bool => strlen ($ match ['before ' ]) % 2 === 0 );
117
117
118
118
$ result = [];
119
- $ positionToIdxMap = [];
120
119
$ positionalPlaceholders = [];
121
- $ idx = $ position = 0 ;
120
+ $ idx = 0 ;
122
121
123
122
foreach ($ placeholders as $ placeholder ) {
124
123
if (isset ($ placeholder ['width ' ]) && $ placeholder ['width ' ] !== '' ) {
125
- $ result [$ idx ] = ['strict-int ' => 1 ];
126
- $ positionToIdxMap [$ position ++] = $ idx ++;
124
+ $ result [$ idx ++] = ['strict-int ' => 1 ];
127
125
}
128
126
129
127
if (isset ($ placeholder ['precision ' ]) && $ placeholder ['precision ' ] !== '' ) {
130
- $ result [$ idx ] = ['strict-int ' => 1 ];
131
- $ positionToIdxMap [$ position ++] = $ idx ++;
128
+ $ result [$ idx ++] = ['strict-int ' => 1 ];
132
129
}
133
130
134
131
if (isset ($ placeholder ['position ' ]) && $ placeholder ['position ' ] !== '' ) {
@@ -137,8 +134,6 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
137
134
continue ;
138
135
}
139
136
140
- $ position ++;
141
- $ positionToIdxMap [$ position ] = $ idx ;
142
137
$ result [$ idx ++][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
143
138
}
144
139
@@ -148,12 +143,7 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
148
143
);
149
144
150
145
foreach ($ positionalPlaceholders as $ placeholder ) {
151
- $ idx = $ positionToIdxMap [$ placeholder ['position ' ]] ?? null ;
152
-
153
- if ($ idx === null ) {
154
- continue ;
155
- }
156
-
146
+ $ idx = $ placeholder ['position ' ] - 1 ;
157
147
$ result [$ idx ][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
158
148
}
159
149
0 commit comments