Skip to content

Commit bce7504

Browse files
Merge branch '5.4' into 6.3
* 5.4: Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2 parents 8a8cd3f + c209c4d commit bce7504

10 files changed

+31
-31
lines changed

AbstractString.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function isEmpty(): bool
383383
return '' === $this->string;
384384
}
385385

386-
abstract public function join(array $strings, string $lastGlue = null): static;
386+
abstract public function join(array $strings, ?string $lastGlue = null): static;
387387

388388
public function jsonSerialize(): string
389389
{
@@ -429,16 +429,16 @@ abstract public function replaceMatches(string $fromRegexp, string|callable $to)
429429

430430
abstract public function reverse(): static;
431431

432-
abstract public function slice(int $start = 0, int $length = null): static;
432+
abstract public function slice(int $start = 0, ?int $length = null): static;
433433

434434
abstract public function snake(): static;
435435

436-
abstract public function splice(string $replacement, int $start = 0, int $length = null): static;
436+
abstract public function splice(string $replacement, int $start = 0, ?int $length = null): static;
437437

438438
/**
439439
* @return static[]
440440
*/
441-
public function split(string $delimiter, int $limit = null, int $flags = null): array
441+
public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
442442
{
443443
if (null === $flags) {
444444
throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
@@ -495,7 +495,7 @@ public function startsWith(string|iterable $prefix): bool
495495

496496
abstract public function title(bool $allWords = false): static;
497497

498-
public function toByteString(string $toEncoding = null): ByteString
498+
public function toByteString(?string $toEncoding = null): ByteString
499499
{
500500
$b = new ByteString();
501501

AbstractUnicodeString.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function folded(bool $compat = true): static
198198
return $str;
199199
}
200200

201-
public function join(array $strings, string $lastGlue = null): static
201+
public function join(array $strings, ?string $lastGlue = null): static
202202
{
203203
$str = clone $this;
204204

ByteString.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(string $string = '')
4242
* Copyright (c) 2004-2020, Facebook, Inc. (https://www.facebook.com/)
4343
*/
4444

45-
public static function fromRandom(int $length = 16, string $alphabet = null): self
45+
public static function fromRandom(int $length = 16, ?string $alphabet = null): self
4646
{
4747
if ($length <= 0) {
4848
throw new InvalidArgumentException(sprintf('A strictly positive length is expected, "%d" given.', $length));
@@ -205,7 +205,7 @@ public function isUtf8(): bool
205205
return '' === $this->string || preg_match('//u', $this->string);
206206
}
207207

208-
public function join(array $strings, string $lastGlue = null): static
208+
public function join(array $strings, ?string $lastGlue = null): static
209209
{
210210
$str = clone $this;
211211

@@ -332,7 +332,7 @@ public function reverse(): static
332332
return $str;
333333
}
334334

335-
public function slice(int $start = 0, int $length = null): static
335+
public function slice(int $start = 0, ?int $length = null): static
336336
{
337337
$str = clone $this;
338338
$str->string = (string) substr($this->string, $start, $length ?? \PHP_INT_MAX);
@@ -348,15 +348,15 @@ public function snake(): static
348348
return $str;
349349
}
350350

351-
public function splice(string $replacement, int $start = 0, int $length = null): static
351+
public function splice(string $replacement, int $start = 0, ?int $length = null): static
352352
{
353353
$str = clone $this;
354354
$str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
355355

356356
return $str;
357357
}
358358

359-
public function split(string $delimiter, int $limit = null, int $flags = null): array
359+
public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
360360
{
361361
if (1 > $limit ??= \PHP_INT_MAX) {
362362
throw new InvalidArgumentException('Split limit must be a positive integer.');
@@ -402,12 +402,12 @@ public function title(bool $allWords = false): static
402402
return $str;
403403
}
404404

405-
public function toUnicodeString(string $fromEncoding = null): UnicodeString
405+
public function toUnicodeString(?string $fromEncoding = null): UnicodeString
406406
{
407407
return new UnicodeString($this->toCodePointString($fromEncoding)->string);
408408
}
409409

410-
public function toCodePointString(string $fromEncoding = null): CodePointString
410+
public function toCodePointString(?string $fromEncoding = null): CodePointString
411411
{
412412
$u = new CodePointString();
413413

CodePointString.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ public function replace(string $from, string $to): static
186186
return $str;
187187
}
188188

189-
public function slice(int $start = 0, int $length = null): static
189+
public function slice(int $start = 0, ?int $length = null): static
190190
{
191191
$str = clone $this;
192192
$str->string = mb_substr($this->string, $start, $length, 'UTF-8');
193193

194194
return $str;
195195
}
196196

197-
public function splice(string $replacement, int $start = 0, int $length = null): static
197+
public function splice(string $replacement, int $start = 0, ?int $length = null): static
198198
{
199199
if (!preg_match('//u', $replacement)) {
200200
throw new InvalidArgumentException('Invalid UTF-8 string.');
@@ -208,7 +208,7 @@ public function splice(string $replacement, int $start = 0, int $length = null):
208208
return $str;
209209
}
210210

211-
public function split(string $delimiter, int $limit = null, int $flags = null): array
211+
public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
212212
{
213213
if (1 > $limit ??= \PHP_INT_MAX) {
214214
throw new InvalidArgumentException('Split limit must be a positive integer.');

Slugger/AsciiSlugger.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
6868
*/
6969
private array $transliterators = [];
7070

71-
public function __construct(string $defaultLocale = null, array|\Closure $symbolsMap = null)
71+
public function __construct(?string $defaultLocale = null, array|\Closure|null $symbolsMap = null)
7272
{
7373
$this->defaultLocale = $defaultLocale;
7474
$this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
@@ -104,7 +104,7 @@ public function withEmoji(bool|string $emoji = true): static
104104
return $new;
105105
}
106106

107-
public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString
107+
public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString
108108
{
109109
$locale ??= $this->defaultLocale;
110110

Slugger/SluggerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ interface SluggerInterface
2323
/**
2424
* Creates a slug for the given string and locale, using appropriate transliteration when needed.
2525
*/
26-
public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString;
26+
public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString;
2727
}

Tests/AbstractAsciiTestCase.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testCreateFromEmptyString()
4646
/**
4747
* @dataProvider provideBytesAt
4848
*/
49-
public function testBytesAt(array $expected, string $string, int $offset, int $form = null)
49+
public function testBytesAt(array $expected, string $string, int $offset, ?int $form = null)
5050
{
5151
if (2 !== grapheme_strlen('च्छे') && 'नमस्ते' === $string) {
5252
$this->markTestSkipped('Skipping due to issue ICU-21661.');
@@ -319,7 +319,7 @@ public static function provideIndexOfLastIgnoreCase(): array
319319
/**
320320
* @dataProvider provideSplit
321321
*/
322-
public function testSplit(string $string, string $delimiter, array $chunks, ?int $limit, int $flags = null)
322+
public function testSplit(string $string, string $delimiter, array $chunks, ?int $limit, ?int $flags = null)
323323
{
324324
$this->assertEquals($chunks, static::createFromString($string)->split($delimiter, $limit, $flags));
325325
}
@@ -595,7 +595,7 @@ public static function provideTitle()
595595
/**
596596
* @dataProvider provideSlice
597597
*/
598-
public function testSlice(string $expected, string $origin, int $start, int $length = null)
598+
public function testSlice(string $expected, string $origin, int $start, ?int $length = null)
599599
{
600600
$this->assertEquals(
601601
static::createFromString($expected),
@@ -623,7 +623,7 @@ public static function provideSlice()
623623
/**
624624
* @dataProvider provideSplice
625625
*/
626-
public function testSplice(string $expected, int $start, int $length = null)
626+
public function testSplice(string $expected, int $start, ?int $length = null)
627627
{
628628
$this->assertEquals(
629629
static::createFromString($expected),
@@ -1081,7 +1081,7 @@ public static function provideSnake()
10811081
/**
10821082
* @dataProvider provideStartsWith
10831083
*/
1084-
public function testStartsWith(bool $expected, string $origin, $prefix, int $form = null)
1084+
public function testStartsWith(bool $expected, string $origin, $prefix, ?int $form = null)
10851085
{
10861086
$instance = static::createFromString($origin);
10871087
$instance = $form ? $instance->normalize($form) : $instance;
@@ -1135,7 +1135,7 @@ public static function provideStartsWithIgnoreCase()
11351135
/**
11361136
* @dataProvider provideEndsWith
11371137
*/
1138-
public function testEndsWith(bool $expected, string $origin, $suffix, int $form = null)
1138+
public function testEndsWith(bool $expected, string $origin, $suffix, ?int $form = null)
11391139
{
11401140
$instance = static::createFromString($origin);
11411141
$instance = $form ? $instance->normalize($form) : $instance;

Tests/AbstractUnicodeTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static function provideBytesAt(): array
7878
/**
7979
* @dataProvider provideCodePointsAt
8080
*/
81-
public function testCodePointsAt(array $expected, string $string, int $offset, int $form = null)
81+
public function testCodePointsAt(array $expected, string $string, int $offset, ?int $form = null)
8282
{
8383
if (2 !== grapheme_strlen('च्छे') && 'नमस्ते' === $string) {
8484
$this->markTestSkipped('Skipping due to issue ICU-21661.');

Tests/Slugger/AsciiSluggerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AsciiSluggerTest extends TestCase
1919
/**
2020
* @dataProvider provideSlugTests
2121
*/
22-
public function testSlug(string $expected, string $string, string $separator = '-', string $locale = null)
22+
public function testSlug(string $expected, string $string, string $separator = '-', ?string $locale = null)
2323
{
2424
$slugger = new AsciiSlugger();
2525

UnicodeString.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function indexOfLast(string|iterable|AbstractString $needle, int $offset
176176
return false === $i ? null : $i;
177177
}
178178

179-
public function join(array $strings, string $lastGlue = null): static
179+
public function join(array $strings, ?string $lastGlue = null): static
180180
{
181181
$str = parent::join($strings, $lastGlue);
182182
normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
@@ -253,7 +253,7 @@ public function replaceMatches(string $fromRegexp, string|callable $to): static
253253
return $str;
254254
}
255255

256-
public function slice(int $start = 0, int $length = null): static
256+
public function slice(int $start = 0, ?int $length = null): static
257257
{
258258
$str = clone $this;
259259

@@ -262,7 +262,7 @@ public function slice(int $start = 0, int $length = null): static
262262
return $str;
263263
}
264264

265-
public function splice(string $replacement, int $start = 0, int $length = null): static
265+
public function splice(string $replacement, int $start = 0, ?int $length = null): static
266266
{
267267
$str = clone $this;
268268

@@ -278,7 +278,7 @@ public function splice(string $replacement, int $start = 0, int $length = null):
278278
return $str;
279279
}
280280

281-
public function split(string $delimiter, int $limit = null, int $flags = null): array
281+
public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
282282
{
283283
if (1 > $limit ??= 2147483647) {
284284
throw new InvalidArgumentException('Split limit must be a positive integer.');

0 commit comments

Comments
 (0)