Skip to content

Commit 1754fe1

Browse files
minor #485 Fix CS (nicolas-grekas)
This PR was merged into the 1.x branch. Discussion ---------- Fix CS Commits ------- 41ef333 Fix CS
2 parents 0e4546d + 41ef333 commit 1754fe1

File tree

22 files changed

+133
-90
lines changed

22 files changed

+133
-90
lines changed

src/Intl/MessageFormatter/MessageFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ private static function parseToken(array $token, array $values, $locale)
296296
$offset = (int) trim(substr($selector, 7, $pos - 7));
297297
$selector = trim(substr($selector, 1 + $pos, \strlen($selector)));
298298
}
299-
if (false === $message && 'other' === $selector ||
300-
'=' === $selector[0] && (int) substr($selector, 1, \strlen($selector)) === $arg ||
301-
'one' === $selector && 1 == $arg - $offset
299+
if (false === $message && 'other' === $selector
300+
|| '=' === $selector[0] && (int) substr($selector, 1, \strlen($selector)) === $arg
301+
|| 'one' === $selector && 1 == $arg - $offset
302302
) {
303303
$message = implode(',', str_replace('#', $arg - $offset, $plural[$i]));
304304
}

src/Mbstring/Mbstring.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public static function mb_encoding_aliases($encoding)
427427

428428
public static function mb_check_encoding($var = null, $encoding = null)
429429
{
430-
if (PHP_VERSION_ID < 70200 && \is_array($var)) {
430+
if (\PHP_VERSION_ID < 70200 && \is_array($var)) {
431431
trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING);
432432

433433
return null;
@@ -454,7 +454,6 @@ public static function mb_check_encoding($var = null, $encoding = null)
454454
}
455455

456456
return true;
457-
458457
}
459458

460459
public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
@@ -888,9 +887,9 @@ public static function mb_ucfirst(string $string, ?string $encoding = null): str
888887
}
889888

890889
$firstChar = mb_substr($string, 0, 1, $encoding);
891-
$firstChar = mb_convert_case($firstChar, MB_CASE_TITLE, $encoding);
890+
$firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding);
892891

893-
return $firstChar . mb_substr($string, 1, null, $encoding);
892+
return $firstChar.mb_substr($string, 1, null, $encoding);
894893
}
895894

896895
public static function mb_lcfirst(string $string, ?string $encoding = null): string
@@ -902,9 +901,9 @@ public static function mb_lcfirst(string $string, ?string $encoding = null): str
902901
}
903902

904903
$firstChar = mb_substr($string, 0, 1, $encoding);
905-
$firstChar = mb_convert_case($firstChar, MB_CASE_LOWER, $encoding);
904+
$firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding);
906905

907-
return $firstChar . mb_substr($string, 1, null, $encoding);
906+
return $firstChar.mb_substr($string, 1, null, $encoding);
908907
}
909908

910909
private static function getSubpart($pos, $part, $haystack, $encoding)

src/Php72/Php72.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public static function stream_isatty($stream)
141141

142142
if ('\\' === \DIRECTORY_SEPARATOR) {
143143
$stat = @fstat($stream);
144+
144145
// Check if formatted mode is S_IFCHR
145146
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
146147
}

src/Php81/Resources/stubs/CURLStringFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __set(string $name, $value): void
3232
}
3333

3434
if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) {
35-
throw new \TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
35+
throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
3636
}
3737

3838
$this->name = 'data://application/octet-stream;base64,'.base64_encode($value);

src/Php82/Php82.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ public static function ini_parse_quantity(string $value): int
180180
while ($digits_consumed < $str_end && false !== strpos($ctype_space, $value[$digits_consumed])) {
181181
++$digits_consumed;
182182
}
183-
if ($digits_consumed !== $str_end && ($value[$digits_consumed] === '+' || $value[$digits_consumed] === '-')) {
183+
if ($digits_consumed !== $str_end && ('+' === $value[$digits_consumed] || '-' === $value[$digits_consumed])) {
184184
++$digits_consumed;
185185
}
186186

187-
if ($value[$digits_consumed] === '0') {
187+
if ('0' === $value[$digits_consumed]) {
188188
/* Value is just 0 */
189189
if ($digits_consumed + 1 === $str_end) {
190190
goto evaluation;
@@ -197,7 +197,7 @@ public static function ini_parse_quantity(string $value): int
197197
case 'b':
198198
case 'B':
199199
$digits_consumed += 2;
200-
break;
200+
break;
201201
}
202202
}
203203

src/Php83/Php83.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Php84/Php84.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public static function mb_ucfirst(string $string, ?string $encoding = null): str
3636
}
3737

3838
$firstChar = mb_substr($string, 0, 1, $encoding);
39-
$firstChar = mb_convert_case($firstChar, MB_CASE_TITLE, $encoding);
39+
$firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding);
4040

41-
return $firstChar . mb_substr($string, 1, null, $encoding);
41+
return $firstChar.mb_substr($string, 1, null, $encoding);
4242
}
4343

4444
public static function mb_lcfirst(string $string, ?string $encoding = null): string
@@ -59,9 +59,9 @@ public static function mb_lcfirst(string $string, ?string $encoding = null): str
5959
}
6060

6161
$firstChar = mb_substr($string, 0, 1, $encoding);
62-
$firstChar = mb_convert_case($firstChar, MB_CASE_LOWER, $encoding);
62+
$firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding);
6363

64-
return $firstChar . mb_substr($string, 1, null, $encoding);
64+
return $firstChar.mb_substr($string, 1, null, $encoding);
6565
}
6666

6767
public static function array_find(array $array, callable $callback)

src/Php84/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
return;
1616
}
1717

18-
1918
if (!function_exists('mb_ucfirst')) {
2019
function mb_ucfirst($string, ?string $encoding = null): string { return p\Php84::mb_ucfirst($string, $encoding); }
2120
}

tests/Iconv/IconvTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function testIconvSubstr()
7272

7373
/**
7474
* @covers \Symfony\Polyfill\Iconv\Iconv::iconv_substr
75+
*
7576
* @requires PHP < 8
7677
*/
7778
public function testIconvSubstrReturnsFalsePrePHP8()
@@ -84,6 +85,7 @@ public function testIconvSubstrReturnsFalsePrePHP8()
8485

8586
/**
8687
* @covers \Symfony\Polyfill\Iconv\Iconv::iconv_substr
88+
*
8789
* @requires PHP 8
8890
*/
8991
public function testIconvSubstrReturnsEmptyPostPHP8()
@@ -169,6 +171,7 @@ public function testIconvMimeDecodeHeaders()
169171
/**
170172
* @covers \Symfony\Polyfill\Iconv\Iconv::iconv_get_encoding
171173
* @covers \Symfony\Polyfill\Iconv\Iconv::iconv_set_encoding
174+
*
172175
* @group legacy
173176
*/
174177
public function testIconvGetEncoding()

tests/Intl/Grapheme/GraphemeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function testGraphemeSubstr()
125125

126126
/**
127127
* @covers \Symfony\Polyfill\Intl\Grapheme\Grapheme::grapheme_substr
128+
*
128129
* @requires PHP < 8
129130
*/
130131
public function testGraphemeSubstrReturnsFalsePrePHP8()
@@ -138,6 +139,7 @@ public function testGraphemeSubstrReturnsFalsePrePHP8()
138139

139140
/**
140141
* @covers \Symfony\Polyfill\Intl\Grapheme\Grapheme::grapheme_substr
142+
*
141143
* @requires PHP 8
142144
*/
143145
public function testGraphemeSubstrReturnsEmptyPostPHP8()

0 commit comments

Comments
 (0)