Skip to content

Commit ff482f3

Browse files
Fix CS
1 parent 0e4546d commit ff482f3

File tree

21 files changed

+133
-89
lines changed

21 files changed

+133
-89
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)

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()

tests/Intl/Icu/Verification/IntlDateFormatterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function testDateAndTimeType($timestamp, $datetype, $timetype, $expected)
7373

7474
/**
7575
* @requires PHP 8
76+
*
7677
* @dataProvider relativeDateTypeProvider
7778
*/
7879
public function testRelativeDateType($timestamp, $datetype, $timetype, $expected)

tests/Intl/Idn/IdnTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Polyfill\Tests\Intl\Idn;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use RuntimeException;
1615
use Symfony\Polyfill\Intl\Idn\Idn;
1716

1817
/**
@@ -198,7 +197,9 @@ public function testToAsciiTransitional($source, $toUnicode, $toUnicodeStatus, $
198197

199198
/**
200199
* @requires PHP < 8
200+
*
201201
* @group legacy
202+
*
202203
* @dataProvider domainNamesProvider
203204
*/
204205
public function testEncode2003($decoded, $encoded)
@@ -218,7 +219,9 @@ public function testEncodeInvalid($decoded)
218219

219220
/**
220221
* @requires PHP < 8
222+
*
221223
* @group legacy
224+
*
222225
* @dataProvider domainNamesProvider
223226
*/
224227
public function testDecode2003($decoded, $encoded)
@@ -275,7 +278,9 @@ public function testUppercaseUTS46($decoded, $ascii, $encoded)
275278

276279
/**
277280
* @requires PHP < 8
281+
*
278282
* @group legacy
283+
*
279284
* @dataProvider domainNamesProvider
280285
*/
281286
public function testEncodePhp53($decoded, $encoded)
@@ -285,7 +290,7 @@ public function testEncodePhp53($decoded, $encoded)
285290
}
286291

287292
/**
288-
* IDNA 15.1.0 revision 31
293+
* IDNA 15.1.0 revision 31.
289294
*
290295
* This tests the change in "Section 4 Processing step 1. Map" which conditionally maps U+1E9E capital sharp s to
291296
* "ss" if Transitional_Processing is used.
@@ -299,7 +304,7 @@ public function testCapitalSharpSProcessing($input, $expected, $flags)
299304
}
300305

301306
/**
302-
* IDNA 15.1.0 revision 31
307+
* IDNA 15.1.0 revision 31.
303308
*
304309
* This tests the additional validity check in "Section 4.1 Validity Criteria Processing step 4", which is used to
305310
* disallow labels that do not round trip.
@@ -312,14 +317,14 @@ public function testLabelsThatDoNotRoundTripAreDisallowed()
312317
}
313318

314319
/**
315-
* IDNA 15.1.0 revision 31
320+
* IDNA 15.1.0 revision 31.
316321
*
317322
* This tests the the additional condition in "Section 4 Processing step 4.1" where a label that starts with "xn--"
318323
* and contains a non-ASCII codepoint records an error and the processing steps continue with the next label.
319324
*/
320325
public function testLabelStartingWithPunycodePrefixWithNonAsciiCharacterRecordsErrorAndIsSkipped()
321326
{
322-
\idn_to_utf8('xn--🌈.xn--fa-hia.de', \IDNA_DEFAULT, \INTL_IDNA_VARIANT_UTS46, $info);
327+
idn_to_utf8('xn--🌈.xn--fa-hia.de', \IDNA_DEFAULT, \INTL_IDNA_VARIANT_UTS46, $info);
323328
$this->assertSame(\IDNA_ERROR_PUNYCODE, \IDNA_ERROR_PUNYCODE & $info['errors']);
324329
$this->assertSame('xn--🌈.faß.de', $info['result']);
325330
}
@@ -332,7 +337,6 @@ public static function captialSharpSProvider()
332337
];
333338
}
334339

335-
336340
public static function domainNamesProvider()
337341
{
338342
return [
@@ -489,11 +493,11 @@ private static function resolveErrorCodes($statusCodes, $inherit)
489493
$matchCount = preg_match_all('/[PVUABCX][0-9](?:_[0-9])?/', $statusCodes, $matches);
490494

491495
if (\PREG_NO_ERROR !== preg_last_error()) {
492-
throw new RuntimeException();
496+
throw new \RuntimeException();
493497
}
494498

495499
if (0 === $matchCount) {
496-
throw new RuntimeException();
500+
throw new \RuntimeException();
497501
}
498502

499503
$errors = [];

tests/Intl/Normalizer/NormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @author Nicolas Grekas <p@tchwork.com>
2121
*
2222
* @covers \Symfony\Polyfill\Intl\Normalizer\Normalizer::<!public>
23+
*
2324
* @requires extension intl
2425
*/
2526
class NormalizerTest extends TestCase
@@ -68,7 +69,7 @@ public function testNormalize()
6869
{
6970
$c = in::normalize('déjà', pn::NFC).in::normalize('훈쇼™', pn::NFD);
7071
if (\PHP_VERSION_ID < 70300) {
71-
$this->assertSame($c, normalizer_normalize($c, \Normalizer::NONE));
72+
$this->assertSame($c, normalizer_normalize($c, in::NONE));
7273
}
7374

7475
$c = 'déjà 훈쇼™';

0 commit comments

Comments
 (0)