Laravel v11.0.7 まとめ
30minで読めるだけ読んだので、全部のリリースはまとめきれてないこともあります。
リリースノートはこちら
- [11.x] Re-add translations for ValidationException by @driesvints in https://github.com/laravel/framework/pull/50546
- [11.x] Removes unused Dumpable trait by @OussamaMater in https://github.com/laravel/framework/pull/50559
- [11.x] Fix withRouting docblock type by @santigarcor in https://github.com/laravel/framework/pull/50563
- [11.x] Fix docblock in FakeInvokedProcess.php by @saMahmoudzadeh in https://github.com/laravel/framework/pull/50568
- [11.x] fix: Add missing InvalidArgumentException import to Database/Schema/SqlServerBuilder by @ayutaya in https://github.com/laravel/framework/pull/50573
- [11.x] Improved translation for displaying the count of errors in the validation message by @andrey-helldar in https://github.com/laravel/framework/pull/50560
- [11.x] Fix retry_after to be an integer by @driesvints in https://github.com/laravel/framework/pull/50580
- [11.x] Use available
getPath()instead of usingapp_path()to detect if base controller exists by @crynobone in https://github.com/laravel/framework/pull/50583 - [11.x] Fix doc block:
@return statichas been modified to@return voidby @saMahmoudzadeh in https://github.com/laravel/framework/pull/50592 - accept attributes for channels by @taylorotwell in https://github.com/laravel/framework/commit/398f49485e305756409b52af64837c784fd30de9
[11.x] Re-add translations for ValidationException by @driesvints
- Validationが失敗した時に作成されるエラーのまとめが翻訳されないバグの修正
- Laravel11になってからのエラーのようです。
Laravel10の場合
[{
"message": "Le champ foo est obligatoire. (et 3 erreurs en plus)",
// ...
}]
Laravel11の場合
[{
"message": "Le champ foo est obligatoire. (and 3 more errors)",
// ...
}].
確かにLaravel11になってから丸括弧の中が訳されてない。
[11.x] Removes unused Dumpable trait by @OussamaMater
過去にQuery/BuilderにDumpableというtraitが追加されたため実装されていたddは削除された。
しかし、Query/Builderを確認したところDumpableは追加されたままでddもメソッドとして存在していた。
そのため、Dumpableの方を削除するというPR。
[11.x] Fix withRouting docblock type by @santigarcor
実際に定義されているメソッドの引数の型とPHPDocの型が一致しなかったようで、その修正をしている。
[11.x] Fix docblock in FakeInvokedProcess.php by @saMahmoudzadeh
メソッドの引数の名前とPHPDocに記載されている引数の名前が一致しなかったようで、その修正をしている。
[11.x] fix: Add missing InvalidArgumentException import to Database/Schema/SqlServerBuilder by @ayutaya
SqlServerBuilderの中でInvalidArgumentExceptionが投げられているが、このExceptionのクラスをインポートしていないバグの修正。
[11.x] Improved translation for displaying the count of errors in the validation message by @andrey-helldar
ロシア語、ウクライナ語などの言語では、複数形の中にさらに形が変わるものが存在するらしい(なんと)。
| Count | English | Russian | Ukrainian |
|---|---|---|---|
| 1 | error | ошибка | помилка |
| 2 | errors | ошибки | помилки |
| 5 | errors | ошибок | помилок |
現在のバリデーションエラーの概要を表示するメッセージでは、複数形が正しく書かれていないようで、その修正を行うPR。
[11.x] Fix retry_after to be an integer by @driesvints
queueの設定でretry_afterという設定が存在しておりconfig/queue.phpにはこんな感じで書かれている。
'retry_after' => env('DB_QUEUE_RETRY_AFTER', 90),
これをLaravelで読み取ると、文字列の90として読み取ってしまうらしく、バグったらしい。
このPRでは単純にintにキャストしている
# 編集後
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
[11.x] Use available getPath() instead of using app_path() to detect if base controller exists by @crynobone
基底のコントローラーファイルの検索方法をapp_pathから$this->getPathに変更していたが変更する理由がわからなかった...
[11.x] Fix doc block: @return static has been modified to @return void by @saMahmoudzadeh
PHPDocの修正。
accept attributes for channels by @taylorotwell
withBroadcastingを設定する時に、attributesを引数として渡せるようにしている。
軽く追ってみた感じだと、middlewareなどの設定が行えるようです。
/**
* Register the routes for handling broadcast channel authentication and sockets.
*
* @param array|null $attributes
* @return void
*/
public function routes(?array $attributes = null)
{
if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) {
return;
}
$attributes = $attributes ?: ['middleware' => ['web']];
$this->app['router']->group($attributes, function ($router) {
$router->match(
['get', 'post'], '/broadcasting/auth',
'\\'.BroadcastController::class.'@authenticate'
)->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
});
}
Discussion