Skip to content

Commit

Permalink
Fix warning and deprecation (#50114)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Feb 16, 2024
1 parent d5a35ef commit cf95132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,10 @@ public static function headline($value)
*/
public static function apa($value)
{
if ($value === '') {
return $value;
}

$minorWords = [
'and', 'as', 'but', 'for', 'if', 'nor', 'or', 'so', 'yet', 'a', 'an',
'the', 'at', 'by', 'for', 'in', 'of', 'off', 'on', 'per', 'to', 'up', 'via',
Expand Down
2 changes: 2 additions & 0 deletions tests/Support/SupportStrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public function testStringApa()
$this->assertSame('To Kill a Mockingbird', Str::apa('to kill a mockingbird'));
$this->assertSame('To Kill a Mockingbird', Str::apa('TO KILL A MOCKINGBIRD'));
$this->assertSame('To Kill a Mockingbird', Str::apa('To Kill A Mockingbird'));

$this->assertSame('', Str::apa(''));
}

public function testStringWithoutWordsDoesntProduceError()
Expand Down

0 comments on commit cf95132

Please sign in to comment.