@@ -116,19 +116,16 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
116116 $ placeholders = array_filter ($ matches , static fn (array $ match ): bool => strlen ($ match ['before ' ]) % 2 === 0 );
117117
118118 $ result = [];
119- $ positionToIdxMap = [];
120119 $ positionalPlaceholders = [];
121- $ idx = $ position = 0 ;
120+ $ idx = 0 ;
122121
123122 foreach ($ placeholders as $ placeholder ) {
124123 if (isset ($ placeholder ['width ' ]) && $ placeholder ['width ' ] !== '' ) {
125- $ result [$ idx ] = ['strict-int ' => 1 ];
126- $ positionToIdxMap [$ position ++] = $ idx ++;
124+ $ result [$ idx ++] = ['strict-int ' => 1 ];
127125 }
128126
129127 if (isset ($ placeholder ['precision ' ]) && $ placeholder ['precision ' ] !== '' ) {
130- $ result [$ idx ] = ['strict-int ' => 1 ];
131- $ positionToIdxMap [$ position ++] = $ idx ++;
128+ $ result [$ idx ++] = ['strict-int ' => 1 ];
132129 }
133130
134131 if (isset ($ placeholder ['position ' ]) && $ placeholder ['position ' ] !== '' ) {
@@ -137,8 +134,6 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
137134 continue ;
138135 }
139136
140- $ position ++;
141- $ positionToIdxMap [$ position ] = $ idx ;
142137 $ result [$ idx ++][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
143138 }
144139
@@ -148,12 +143,7 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
148143 );
149144
150145 foreach ($ positionalPlaceholders as $ placeholder ) {
151- $ idx = $ positionToIdxMap [$ placeholder ['position ' ]] ?? null ;
152-
153- if ($ idx === null ) {
154- continue ;
155- }
156-
146+ $ idx = $ placeholder ['position ' ] - 1 ;
157147 $ result [$ idx ][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
158148 }
159149
0 commit comments