diff --git a/src/Str.php b/src/Str.php index 4fb07ad..b1cd19c 100644 --- a/src/Str.php +++ b/src/Str.php @@ -54,11 +54,11 @@ public static function startsWith(?string $subject, string $start, bool $caseSen * @param ?string $subject * @param string $delimiter * @param int $limit - * @param mixed $default + * @param ?string $default * - * @return array + * @return array */ - public static function symmetricSplit(?string $subject, string $delimiter, int $limit, $default = null) + public static function symmetricSplit(?string $subject, string $delimiter, int $limit, ?string $default = null) { if ($subject === null || empty($delimiter)) { return array_pad([], $limit, $default); diff --git a/tests/StrTest.php b/tests/StrTest.php index fbe721d..d4c7075 100644 --- a/tests/StrTest.php +++ b/tests/StrTest.php @@ -54,7 +54,7 @@ public function testSymmetricSplitReturnsArrayPaddedToTheSizeSpecifiedByLimitUsi public function testSymmetricSplitReturnsArrayPaddedToTheSizeSpecifiedByLimitUsingCustomValue() { - $this->assertSame(['foo', 'bar', false, false], Str::symmetricSplit('foo,bar', ',', 4, false)); + $this->assertSame(['foo', 'bar', 'default', 'default'], Str::symmetricSplit('foo,bar', ',', 4, 'default')); } public function testSymmetricSplitReturnsUnpaddedArrayIfTheSizeOfTheExplodedStringIsLessThanLimit()