Skip to content

Commit

Permalink
Merge branch '10.x' into 11.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/Mail/MailSesV2TransportTest.php
  • Loading branch information
driesvints committed May 21, 2024
2 parents 21e6d31 + ac9b6fa commit 41409f4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: update changelog

on:
release:
types: [released]

jobs:
update:
uses: laravel/.github/.github/workflows/update-changelog.yml@main
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@ public function addNestedWhereQuery($query, $boolean = 'and')
*
* @param \Illuminate\Contracts\Database\Query\Expression|string $column
* @param string $operator
* @param \Closure||\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $callback
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $callback
* @param string $boolean
* @return $this
*/
Expand Down
9 changes: 5 additions & 4 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -1316,22 +1316,23 @@ public static function apa($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',
'et', 'ou', 'un', 'une', 'la', 'le', 'les', 'de', 'du', 'des', 'par', 'à',
];

$endPunctuation = ['.', '!', '?', ':', '', ','];

$words = preg_split('/\s+/', $value, -1, PREG_SPLIT_NO_EMPTY);

$words[0] = ucfirst(mb_strtolower($words[0]));

for ($i = 0; $i < count($words); $i++) {
$lowercaseWord = mb_strtolower($words[$i]);

if (str_contains($lowercaseWord, '-')) {
$hyphenatedWords = explode('-', $lowercaseWord);

$hyphenatedWords = array_map(function ($part) use ($minorWords) {
return (in_array($part, $minorWords) && mb_strlen($part) <= 3) ? $part : ucfirst($part);
return (in_array($part, $minorWords) && mb_strlen($part) <= 3)
? $part
: mb_strtoupper(mb_substr($part, 0, 1)).mb_substr($part, 1);
}, $hyphenatedWords);

$words[$i] = implode('-', $hyphenatedWords);
Expand All @@ -1341,7 +1342,7 @@ public static function apa($value)
! ($i === 0 || in_array(mb_substr($words[$i - 1], -1), $endPunctuation))) {
$words[$i] = $lowercaseWord;
} else {
$words[$i] = ucfirst($lowercaseWord);
$words[$i] = mb_strtoupper(mb_substr($lowercaseWord, 0, 1)).mb_substr($lowercaseWord, 1);
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/Illuminate/View/ViewServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function registerEngineResolver()
public function registerFileEngine($resolver)
{
$resolver->register('file', function () {
return new FileEngine($this->app['files']);
return new FileEngine(app()->make('files'));
});
}

Expand All @@ -148,7 +148,7 @@ public function registerFileEngine($resolver)
public function registerPhpEngine($resolver)
{
$resolver->register('php', function () {
return new PhpEngine($this->app['files']);
return new PhpEngine(app()->make('files'));
});
}

Expand All @@ -161,9 +161,14 @@ public function registerPhpEngine($resolver)
public function registerBladeEngine($resolver)
{
$resolver->register('blade', function () {
$compiler = new CompilerEngine($this->app['blade.compiler'], $this->app['files']);
$app = app();

$this->app->terminating(static function () use ($compiler) {
$compiler = new CompilerEngine(
$app->make('blade.compiler'),
$app->make('files'),
);

$app->terminating(static function () use ($compiler) {
$compiler->forgetCompiledOrNotExpired();
});

Expand Down
12 changes: 12 additions & 0 deletions tests/Support/SupportStrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ 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('Être Écrivain Commence par Être un Lecteur.', Str::apa('Être écrivain commence par être un lecteur.'));
$this->assertSame('Être Écrivain Commence par Être un Lecteur.', Str::apa('Être Écrivain Commence par Être un Lecteur.'));
$this->assertSame('Être Écrivain Commence par Être un Lecteur.', Str::apa('ÊTRE ÉCRIVAIN COMMENCE PAR ÊTRE UN LECTEUR.'));

$this->assertSame("C'est-à-Dire.", Str::apa("c'est-à-dire."));
$this->assertSame("C'est-à-Dire.", Str::apa("C'est-à-Dire."));
$this->assertSame("C'est-à-Dire.", Str::apa("C'EsT-À-DIRE."));

$this->assertSame('Устное Слово – Не Воробей. Как Только Он Вылетит, Его Не Поймаешь.', Str::apa('устное слово – не воробей. как только он вылетит, его не поймаешь.'));
$this->assertSame('Устное Слово – Не Воробей. Как Только Он Вылетит, Его Не Поймаешь.', Str::apa('Устное Слово – Не Воробей. Как Только Он Вылетит, Его Не Поймаешь.'));
$this->assertSame('Устное Слово – Не Воробей. Как Только Он Вылетит, Его Не Поймаешь.', Str::apa('УСТНОЕ СЛОВО – НЕ ВОРОБЕЙ. КАК ТОЛЬКО ОН ВЫЛЕТИТ, ЕГО НЕ ПОЙМАЕШЬ.'));

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

0 comments on commit 41409f4

Please sign in to comment.