@@ -114,19 +114,16 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
114114 $ placeholders = array_filter ($ matches , static fn (array $ match ): bool => strlen ($ match ['before ' ]) % 2 === 0 );
115115
116116 $ result = [];
117- $ positionToIdxMap = [];
118117 $ positionalPlaceholders = [];
119- $ idx = $ position = 0 ;
118+ $ idx = 0 ;
120119
121120 foreach ($ placeholders as $ placeholder ) {
122121 if (isset ($ placeholder ['width ' ]) && $ placeholder ['width ' ] !== '' ) {
123- $ result [$ idx ] = ['strict-int ' => 1 ];
124- $ positionToIdxMap [$ position ++] = $ idx ++;
122+ $ result [$ idx ++] = ['strict-int ' => 1 ];
125123 }
126124
127125 if (isset ($ placeholder ['precision ' ]) && $ placeholder ['precision ' ] !== '' ) {
128- $ result [$ idx ] = ['strict-int ' => 1 ];
129- $ positionToIdxMap [$ position ++] = $ idx ++;
126+ $ result [$ idx ++] = ['strict-int ' => 1 ];
130127 }
131128
132129 if (isset ($ placeholder ['position ' ]) && $ placeholder ['position ' ] !== '' ) {
@@ -135,8 +132,6 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
135132 continue ;
136133 }
137134
138- $ position ++;
139- $ positionToIdxMap [$ position ] = $ idx ;
140135 $ result [$ idx ++][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
141136 }
142137
@@ -146,12 +141,7 @@ private function parsePlaceholders(string $specifiersPattern, string $format): a
146141 );
147142
148143 foreach ($ positionalPlaceholders as $ placeholder ) {
149- $ idx = $ positionToIdxMap [$ placeholder ['position ' ]] ?? null ;
150-
151- if ($ idx === null ) {
152- continue ;
153- }
154-
144+ $ idx = $ placeholder ['position ' ] - 1 ;
155145 $ result [$ idx ][$ this ->getAcceptingTypeBySpecifier ($ placeholder ['specifier ' ] ?? '' )] = 1 ;
156146 }
157147
0 commit comments