Skip to content

Commit cf95132

Browse files
authored
Fix warning and deprecation (#50114)
1 parent d5a35ef commit cf95132

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Illuminate/Support/Str.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,10 @@ public static function headline($value)
12981298
*/
12991299
public static function apa($value)
13001300
{
1301+
if ($value === '') {
1302+
return $value;
1303+
}
1304+
13011305
$minorWords = [
13021306
'and', 'as', 'but', 'for', 'if', 'nor', 'or', 'so', 'yet', 'a', 'an',
13031307
'the', 'at', 'by', 'for', 'in', 'of', 'off', 'on', 'per', 'to', 'up', 'via',

tests/Support/SupportStrTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ public function testStringApa()
9696
$this->assertSame('To Kill a Mockingbird', Str::apa('to kill a mockingbird'));
9797
$this->assertSame('To Kill a Mockingbird', Str::apa('TO KILL A MOCKINGBIRD'));
9898
$this->assertSame('To Kill a Mockingbird', Str::apa('To Kill A Mockingbird'));
99+
100+
$this->assertSame('', Str::apa(''));
99101
}
100102

101103
public function testStringWithoutWordsDoesntProduceError()

0 commit comments

Comments
 (0)