@@ -90,17 +90,17 @@ public static function str_increment(string $string): string
9090 throw new \ValueError ('str_increment(): Argument #1 ($string) cannot be empty ' );
9191 }
9292
93- if (!\ preg_match (" /^[a-zA-Z0-9]+$/ " , $ string )) {
93+ if (!preg_match (' /^[a-zA-Z0-9]+$/ ' , $ string )) {
9494 throw new \ValueError ('str_increment(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters ' );
9595 }
9696
97- if (\ is_numeric ($ string )) {
97+ if (is_numeric ($ string )) {
9898 $ offset = stripos ($ string , 'e ' );
99- if ($ offset !== false ) {
99+ if (false !== $ offset ) {
100100 $ char = $ string [$ offset ];
101- $ char ++ ;
101+ ++ $ char ;
102102 $ string [$ offset ] = $ char ;
103- $ string ++ ;
103+ ++ $ string ;
104104
105105 switch ($ string [$ offset ]) {
106106 case 'f ' :
@@ -130,64 +130,64 @@ public static function str_decrement(string $string): string
130130 throw new \ValueError ('str_decrement(): Argument #1 ($string) cannot be empty ' );
131131 }
132132
133- if (!\ preg_match (" /^[a-zA-Z0-9]+$/ " , $ string )) {
133+ if (!preg_match (' /^[a-zA-Z0-9]+$/ ' , $ string )) {
134134 throw new \ValueError ('str_decrement(): Argument #1 ($string) must be composed only of alphanumeric ASCII characters ' );
135135 }
136136
137- if (\ preg_match ('/\A(?:0[aA0]?|[aA])\z/ ' , $ string )) {
137+ if (preg_match ('/\A(?:0[aA0]?|[aA])\z/ ' , $ string )) {
138138 throw new \ValueError (sprintf ('str_decrement(): Argument #1 ($string) "%s" is out of decrement range ' , $ string ));
139139 }
140140
141141 if (!\in_array (substr ($ string , -1 ), ['A ' , 'a ' , '0 ' ], true )) {
142- return join ('' , array_slice (str_split ($ string ), 0 , -1 )) . chr (ord (substr ($ string , -1 )) - 1 );
142+ return implode ('' , \ array_slice (str_split ($ string ), 0 , -1 )). \ chr (\ ord (substr ($ string , -1 )) - 1 );
143143 }
144144
145145 $ carry = '' ;
146146 $ decremented = '' ;
147147
148- for ($ i = strlen ($ string ) - 1 ; $ i >= 0 ; $ i -- ) {
148+ for ($ i = \ strlen ($ string ) - 1 ; $ i >= 0 ; -- $ i ) {
149149 $ char = $ string [$ i ];
150150
151151 switch ($ char ) {
152152 case 'A ' :
153153 if ('' !== $ carry ) {
154- $ decremented = $ carry . $ decremented ;
154+ $ decremented = $ carry. $ decremented ;
155155 $ carry = '' ;
156156 }
157157 $ carry = 'Z ' ;
158158
159159 break ;
160160 case 'a ' :
161161 if ('' !== $ carry ) {
162- $ decremented = $ carry . $ decremented ;
162+ $ decremented = $ carry. $ decremented ;
163163 $ carry = '' ;
164164 }
165165 $ carry = 'z ' ;
166166
167167 break ;
168168 case '0 ' :
169169 if ('' !== $ carry ) {
170- $ decremented = $ carry . $ decremented ;
170+ $ decremented = $ carry. $ decremented ;
171171 $ carry = '' ;
172172 }
173173 $ carry = '9 ' ;
174174
175175 break ;
176176 case '1 ' :
177177 if ('' !== $ carry ) {
178- $ decremented = $ carry . $ decremented ;
178+ $ decremented = $ carry. $ decremented ;
179179 $ carry = '' ;
180180 }
181181
182182 break ;
183183 default :
184184 if ('' !== $ carry ) {
185- $ decremented = $ carry . $ decremented ;
185+ $ decremented = $ carry. $ decremented ;
186186 $ carry = '' ;
187187 }
188188
189189 if (!\in_array ($ char , ['A ' , 'a ' , '0 ' ], true )) {
190- $ decremented = chr (ord ($ char ) - 1 ) . $ decremented ;
190+ $ decremented = \ chr (\ ord ($ char ) - 1 ). $ decremented ;
191191 }
192192 }
193193 }
0 commit comments