From ae974764c232f4899212ec70dbc51e312374e482 Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Tue, 27 Oct 2026 09:12:51 +0100 Subject: [PATCH] feat: rector to php 8.5 --- app/Console/Commands/UserCreate.php | 2 + app/Console/Kernel.php | 1 + app/Exceptions/Handler.php | 6 +- app/Http/Controllers/Bo/AdviceController.php | 4 +- app/Http/Controllers/Bo/EncartsController.php | 4 +- app/Http/Controllers/Bo/GammesController.php | 14 +- app/Http/Controllers/Bo/MomentsController.php | 4 +- .../Controllers/Bo/PictoBrandsController.php | 12 +- app/Http/Controllers/Bo/PictosController.php | 12 +- app/Http/Controllers/Bo/PostsController.php | 12 +- .../Controllers/Bo/ProductsController.php | 63 ++++--- app/Http/Controllers/Bo/SeoDataController.php | 2 +- app/Http/Controllers/Bo/SlidersController.php | 14 +- app/Http/Controllers/Bo/SlidesController.php | 10 +- app/Http/Controllers/Bo/TextsController.php | 14 +- app/Http/Controllers/Bo/TitlesController.php | 4 +- app/Http/Controllers/ContactController.php | 10 +- app/Http/Controllers/GammesController.php | 2 +- app/Http/Controllers/HomeController.php | 16 +- app/Http/Controllers/NewsController.php | 4 +- app/Http/Kernel.php | 5 +- app/Http/Middleware/AdminSecureMiddleware.php | 20 +-- app/Http/Middleware/EncryptCookies.php | 1 + app/Http/Middleware/FrontEndGlobals.php | 6 +- app/Http/Middleware/LangCheck.php | 6 +- .../PreventRequestsDuringMaintenance.php | 1 + app/Http/Middleware/TrimStrings.php | 1 + app/Http/Middleware/TrustProxies.php | 2 + app/Http/Middleware/VerifyCsrfToken.php | 3 +- app/Http/Requests/StorePostRequest.php | 10 +- app/Http/Requests/StoreProductRequest.php | 48 +++--- app/Http/Requests/StoreSlideRequest.php | 14 +- app/Lib/AdminSecure.php | 18 +- app/Lib/Helpers/ExceptionsHelper.php | 19 +-- app/Lib/Helpers/ToolboxHelper.php | 36 ++-- app/Lib/Options.php | 14 +- app/Lib/Utils.php | 4 +- app/Models/Advice.php | 7 +- app/Models/Encart.php | 7 +- app/Models/Gamme.php | 13 +- app/Models/Moment.php | 7 +- app/Models/Picto.php | 7 +- app/Models/PictoBrand.php | 7 +- app/Models/Post.php | 8 +- app/Models/Product.php | 7 +- app/Models/SeoDatum.php | 1 + app/Models/Slide.php | 8 +- app/Models/Slider.php | 7 +- app/Models/Text.php | 1 + app/Models/Title.php | 1 + app/Models/User.php | 7 +- app/Providers/AuthServiceProvider.php | 1 + app/Providers/EventServiceProvider.php | 1 + app/Providers/RouteServiceProvider.php | 6 +- bootstrap/app.php | 2 +- composer.json | 2 + composer.lock | 159 +++++++++++++++++- config/database.php | 2 +- config/sentry.php | 2 +- database/factories/AdviceFactory.php | 1 + database/factories/EncartFactory.php | 1 + database/factories/GammeFactory.php | 2 +- database/factories/MomentFactory.php | 1 + database/factories/PictoBrandFactory.php | 1 + database/factories/PictoFactory.php | 1 + database/factories/PostFactory.php | 4 +- database/factories/ProductFactory.php | 58 +++---- database/factories/SlideFactory.php | 7 +- database/factories/SliderFactory.php | 1 + database/factories/TextFactory.php | 1 + database/factories/TitleFactory.php | 1 + database/factories/UserFactory.php | 9 +- .../2014_10_12_000000_create_users_table.php | 7 +- ...12_100000_create_password_resets_table.php | 7 +- ..._08_19_000000_create_failed_jobs_table.php | 7 +- ...2021_04_14_115938_create_encarts_table.php | 7 +- ...2021_04_14_115938_create_sliders_table.php | 7 +- .../2021_04_14_115954_create_slides_table.php | 7 +- .../2021_12_10_140929_create_pictos_table.php | 7 +- ...12_10_143830_create_picto_brands_table.php | 7 +- .../2021_12_10_150259_create_titles_table.php | 7 +- .../2021_12_14_161711_create_texts_table.php | 7 +- .../2021_12_16_093950_create_advice_table.php | 7 +- .../2021_12_16_131639_create_posts_table.php | 7 +- .../2021_12_20_145730_create_gammes_table.php | 7 +- ...021_12_22_100045_create_products_table.php | 7 +- ...2022_01_27_112601_create_moments_table.php | 7 +- ...3_11_160745_dropuniqueslug_on_products.php | 7 +- ...2_05_12_101807_add_is_news_on_products.php | 9 +- ...022_05_12_110531_create_seo_data_table.php | 7 +- database/seeders/EncartsSeeder.php | 2 +- database/seeders/GammesSeeder.php | 132 +++++++-------- database/seeders/PictosSeeder.php | 2 +- database/seeders/SlidersSeeder.php | 4 +- database/seeders/TextsSeeder.php | 2 +- rector.php | 57 +++++++ routes/console.php | 2 +- routes/web.php | 6 +- 98 files changed, 652 insertions(+), 452 deletions(-) create mode 100644 rector.php diff --git a/app/Console/Commands/UserCreate.php b/app/Console/Commands/UserCreate.php index b6ec29b..2a099c0 100644 --- a/app/Console/Commands/UserCreate.php +++ b/app/Console/Commands/UserCreate.php @@ -13,6 +13,7 @@ class UserCreate extends Command * * @var string */ + #[\Override] protected $signature = 'user:create'; /** @@ -20,6 +21,7 @@ class UserCreate extends Command * * @var string */ + #[\Override] protected $description = 'Create a backend user'; /** diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 9569fc2..e40f264 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel * * @var array */ + #[\Override] protected $commands = []; /** diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 9eba6c1..dbaf6eb 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -31,6 +31,7 @@ class Handler extends ExceptionHandler * * @var array */ + #[\Override] protected $dontReport = []; /** @@ -38,6 +39,7 @@ class Handler extends ExceptionHandler * * @var array */ + #[\Override] protected $dontFlash = [ 'current_password', 'password', @@ -50,9 +52,9 @@ class Handler extends ExceptionHandler */ public function register() { - $this->reportable(function (\Throwable $e) { + $this->reportable(function (\Throwable $e): void { if (app()->bound('sentry')) { - app('sentry')->captureException($e); + resolve('sentry')->captureException($e); } }); } diff --git a/app/Http/Controllers/Bo/AdviceController.php b/app/Http/Controllers/Bo/AdviceController.php index 679e0e9..0aef95f 100644 --- a/app/Http/Controllers/Bo/AdviceController.php +++ b/app/Http/Controllers/Bo/AdviceController.php @@ -43,11 +43,11 @@ class AdviceController extends Controller } if (!$advice->saveOrFail()) { - return redirect()->route('bo.advice.edit', $advice->id) + return to_route('bo.advice.edit', $advice->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.advice.edit', $advice->id) + return to_route('bo.advice.edit', $advice->id) ->with('success', trans('Modifications enregistrées !')); } } diff --git a/app/Http/Controllers/Bo/EncartsController.php b/app/Http/Controllers/Bo/EncartsController.php index f0c63c0..ccd61ae 100644 --- a/app/Http/Controllers/Bo/EncartsController.php +++ b/app/Http/Controllers/Bo/EncartsController.php @@ -37,11 +37,11 @@ class EncartsController extends Controller } if (!$encart->saveOrFail()) { - return redirect()->route('bo.encarts.edit', $encart->id) + return to_route('bo.encarts.edit', $encart->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.encarts.edit', $encart->id) + return to_route('bo.encarts.edit', $encart->id) ->with('success', trans('Modifications enregistrées !')); } } diff --git a/app/Http/Controllers/Bo/GammesController.php b/app/Http/Controllers/Bo/GammesController.php index 6295de8..fec65e8 100644 --- a/app/Http/Controllers/Bo/GammesController.php +++ b/app/Http/Controllers/Bo/GammesController.php @@ -25,7 +25,7 @@ class GammesController extends Controller foreach ($dbGammes as $gamme) { $gammes->push($gamme); $gamme->childGammes->sortBy('title') - ->map(function (Gamme $childGamme) use (&$gammes) { + ->map(function (Gamme $childGamme) use (&$gammes): void { $gammes->push($childGamme); }); } @@ -69,9 +69,9 @@ class GammesController extends Controller } if (!$gamme->saveOrFail()) { - return redirect()->route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee'); + return to_route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee'); } - return redirect()->route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !'); + return to_route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !'); } /** @@ -111,11 +111,11 @@ class GammesController extends Controller } if (!$gamme->saveOrFail()) { - return redirect()->route('bo.gammes.edit', $gamme->id) + return to_route('bo.gammes.edit', $gamme->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.gammes.edit', $gamme->id) + return to_route('bo.gammes.edit', $gamme->id) ->with('success', trans('Modifications enregistrées !')); } @@ -128,9 +128,9 @@ class GammesController extends Controller public function destroy(Gamme $gamme) { if (!$gamme->delete()) { - return redirect()->route('bo.gammes.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.gammes.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.gammes.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.gammes.index')->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/MomentsController.php b/app/Http/Controllers/Bo/MomentsController.php index a927382..7d87973 100644 --- a/app/Http/Controllers/Bo/MomentsController.php +++ b/app/Http/Controllers/Bo/MomentsController.php @@ -49,11 +49,11 @@ class MomentsController extends Controller } if (!$moment->saveOrFail()) { - return redirect()->route('bo.moments.edit', $moment->id) + return to_route('bo.moments.edit', $moment->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.moments.edit', $moment->id) + return to_route('bo.moments.edit', $moment->id) ->with('success', trans('Modifications enregistrées !')); } } diff --git a/app/Http/Controllers/Bo/PictoBrandsController.php b/app/Http/Controllers/Bo/PictoBrandsController.php index 8da642d..4994517 100644 --- a/app/Http/Controllers/Bo/PictoBrandsController.php +++ b/app/Http/Controllers/Bo/PictoBrandsController.php @@ -49,10 +49,10 @@ class PictoBrandsController extends Controller } if (!$pictobrand->saveOrFail()) { - return redirect()->route('bo.pictobrands.edit', $pictobrand->id) + return to_route('bo.pictobrands.edit', $pictobrand->id) ->with('error', 'Le pictogramme n\'a pas été crée'); } - return redirect()->route('bo.pictobrands.edit', $pictobrand->id) + return to_route('bo.pictobrands.edit', $pictobrand->id) ->with('success', 'Pictogramme créé !'); } @@ -84,11 +84,11 @@ class PictoBrandsController extends Controller } if (!$pictobrand->saveOrFail()) { - return redirect()->route('bo.pictobrands.edit', $pictobrand->id) + return to_route('bo.pictobrands.edit', $pictobrand->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.pictobrands.edit', $pictobrand->id) + return to_route('bo.pictobrands.edit', $pictobrand->id) ->with('success', trans('Modifications enregistrées !')); } @@ -101,9 +101,9 @@ class PictoBrandsController extends Controller public function destroy(PictoBrand $pictobrand) { if (!$pictobrand->delete()) { - return redirect()->route('bo.pictobrands.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.pictobrands.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/PictosController.php b/app/Http/Controllers/Bo/PictosController.php index 5ca867c..fccd62e 100644 --- a/app/Http/Controllers/Bo/PictosController.php +++ b/app/Http/Controllers/Bo/PictosController.php @@ -55,9 +55,9 @@ class PictosController extends Controller $picto->page = Page::marqueBloc2(); if (!$picto->saveOrFail()) { - return redirect()->route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée'); + return to_route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée'); } - return redirect()->route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !'); + return to_route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !'); } /** @@ -88,11 +88,11 @@ class PictosController extends Controller } if (!$picto->saveOrFail()) { - return redirect()->route('bo.pictos.edit', $picto->id) + return to_route('bo.pictos.edit', $picto->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.pictos.edit', $picto->id) + return to_route('bo.pictos.edit', $picto->id) ->with('success', trans('Modifications enregistrées !')); } @@ -105,11 +105,11 @@ class PictosController extends Controller public function destroy(Picto $picto) { if (!$picto->delete()) { - return redirect()->route('bo.pictos.content', $picto->page) + return to_route('bo.pictos.content', $picto->page) ->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.pictos.content', $picto->page) + return to_route('bo.pictos.content', $picto->page) ->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/PostsController.php b/app/Http/Controllers/Bo/PostsController.php index 6219256..cc75e36 100644 --- a/app/Http/Controllers/Bo/PostsController.php +++ b/app/Http/Controllers/Bo/PostsController.php @@ -55,9 +55,9 @@ class PostsController extends Controller $response = $post->saveOrFail(); } if (!$response) { - return redirect()->route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee'); + return to_route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee'); } - return redirect()->route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !'); + return to_route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !'); } /** @@ -95,11 +95,11 @@ class PostsController extends Controller $response = $post->saveOrFail(); } if (!$response) { - return redirect()->route('bo.posts.edit', $post->id) + return to_route('bo.posts.edit', $post->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.posts.edit', $post->id) + return to_route('bo.posts.edit', $post->id) ->with('success', trans('Modifications enregistrées !')); } @@ -112,10 +112,10 @@ class PostsController extends Controller public function destroy(Post $post) { if (!$post->delete()) { - return redirect()->route('bo.posts.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.posts.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.posts.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.posts.index')->with('success', trans('Suppression faite avec succès')); } /** diff --git a/app/Http/Controllers/Bo/ProductsController.php b/app/Http/Controllers/Bo/ProductsController.php index 1262a0b..3823371 100644 --- a/app/Http/Controllers/Bo/ProductsController.php +++ b/app/Http/Controllers/Bo/ProductsController.php @@ -36,93 +36,93 @@ class ProductsController extends Controller { $gammes = Gamme::all()->sortBy('title'); // Default structure + produits. - $tabFour = array( + $tabFour = [ 'id' => 0, 'name' => 'Four', 'url' => '/assets/images/four.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabFriteuse = array( + ]; + $tabFriteuse = [ 'id' => 1, 'name' => 'Friteuse', 'url' => '/assets/images/friteuse.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabPoele = array( + ]; + $tabPoele = [ 'id' => 2, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabCocotte = array( + ]; + $tabCocotte = [ 'id' => 3, 'name' => 'Cocotte', 'url' => '/assets/images/cocotte.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabPlancha = array( + ]; + $tabPlancha = [ 'id' => 4, 'name' => 'Plancha', 'url' => '/assets/images/plancha.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabBainMarie = array( + ]; + $tabBainMarie = [ 'id' => 5, 'name' => 'Bain Marie', 'url' => '/assets/images/bainmarie.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabBarbecue = array( + ]; + $tabBarbecue = [ 'id' => 6, 'name' => 'Barbecue', 'url' => '/assets/images/barbecue.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabMicroOndes = array( + ]; + $tabMicroOndes = [ 'id' => 7, 'name' => 'Micro Ondes', 'url' => '/assets/images/microondes.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabCasserole = array( + ]; + $tabCasserole = [ 'id' => 8, 'name' => 'Casserole', 'url' => '/assets/images/casserole.png', 'time' => '', 'temp' => '', 'status' => false - ); - $tabPlusProduit1 = array( + ]; + $tabPlusProduit1 = [ 'id' => 0, 'name' => '', 'url' => '', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => '', 'url' => '', - ); - $tabPlusProduit3 = array( + ]; + $tabPlusProduit3 = [ 'id' => 2, 'name' => '', 'url' => '', - ); + ]; //phpcs:ignore Generic.Files.LineLength.TooLong $product->pictos = json_encode([$tabFour, $tabFriteuse, $tabPoele, $tabCocotte, $tabPlancha, $tabBainMarie, $tabBarbecue, $tabMicroOndes, $tabCasserole]); $product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]); @@ -153,12 +153,9 @@ class ProductsController extends Controller $product->plusproduit = json_encode($plusproduit); if (!$product->saveOrFail()) { - return redirect()->route( - 'bo.products.edit', - $product->id - )->with('error', 'Le produit n\'a pas été crée'); + return to_route('bo.products.edit', $product->id)->with('error', 'Le produit n\'a pas été crée'); } - return redirect()->route('bo.products.edit', $product->id)->with('success', 'Produit créé !'); + return to_route('bo.products.edit', $product->id)->with('success', 'Produit créé !'); } /** @@ -210,11 +207,11 @@ class ProductsController extends Controller // Encodage avant save. $product->plusproduit = json_encode($plusproduit); if (!$product->saveOrFail()) { - return redirect()->route('bo.products.edit', $product->id) + return to_route('bo.products.edit', $product->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.products.edit', $product->id) + return to_route('bo.products.edit', $product->id) ->with('success', trans('Modifications enregistrées !')); } @@ -227,9 +224,9 @@ class ProductsController extends Controller public function destroy(Product $product) { if (!$product->delete()) { - return redirect()->route('bo.products.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.products.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.products.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.products.index')->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/SeoDataController.php b/app/Http/Controllers/Bo/SeoDataController.php index 4ba9253..91b95f6 100644 --- a/app/Http/Controllers/Bo/SeoDataController.php +++ b/app/Http/Controllers/Bo/SeoDataController.php @@ -33,7 +33,7 @@ class SeoDataController extends Controller $SeoDatum->fill($request->validated()); $SeoDatum->save(); - return redirect()->route('bo.seo_data.edit', $SeoDatum->page) + return to_route('bo.seo_data.edit', $SeoDatum->page) ->with('success', trans('Modifications enregistrées !')); } } diff --git a/app/Http/Controllers/Bo/SlidersController.php b/app/Http/Controllers/Bo/SlidersController.php index c9568dd..c4d751c 100644 --- a/app/Http/Controllers/Bo/SlidersController.php +++ b/app/Http/Controllers/Bo/SlidersController.php @@ -45,9 +45,9 @@ class SlidersController extends Controller $slider = new Slider($request->validated()); if (!$slider->saveOrFail()) { - return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée'); + return to_route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée'); } - return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !'); + return to_route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !'); } /** @@ -75,10 +75,10 @@ class SlidersController extends Controller $slider->fill($request->validated()); if (!$slider->saveOrFail()) { - return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué'); + return to_route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué'); } - return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !'); + return to_route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !'); } /** @@ -92,12 +92,12 @@ class SlidersController extends Controller $count = Slider::count(); if ($count === 1) { - return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider"); + return back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider"); } if (!$slider->delete()) { - return redirect()->route('bo.sliders.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.sliders.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.sliders.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.sliders.index')->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/SlidesController.php b/app/Http/Controllers/Bo/SlidesController.php index 67a2d4e..75a7899 100644 --- a/app/Http/Controllers/Bo/SlidesController.php +++ b/app/Http/Controllers/Bo/SlidesController.php @@ -52,7 +52,7 @@ class SlidesController extends Controller $slide->saveOrFail(); - return redirect()->route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !'); + return to_route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !'); } /** @@ -84,10 +84,10 @@ class SlidesController extends Controller } if (!$slide->saveOrFail()) { - return redirect()->route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué')); + return to_route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !')); + return to_route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !')); } /** @@ -99,10 +99,10 @@ class SlidesController extends Controller public function destroy(Slide $slide) { if (!$slide->delete()) { - return redirect()->route('bo.slides.index')->with('error', trans('La suppression a échoué')); + return to_route('bo.slides.index')->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès')); + return to_route('bo.slides.index')->with('success', trans('Suppression faite avec succès')); } /** diff --git a/app/Http/Controllers/Bo/TextsController.php b/app/Http/Controllers/Bo/TextsController.php index 5b85284..a78e73e 100644 --- a/app/Http/Controllers/Bo/TextsController.php +++ b/app/Http/Controllers/Bo/TextsController.php @@ -46,12 +46,10 @@ class TextsController extends Controller $text->page = Page::newsQuestions(); if (!$text->saveOrFail()) { - return redirect() - ->route('bo.texts.edit', $text->id) + return to_route('bo.texts.edit', $text->id) ->with('error', 'La question/réponse n\'a pas été créée'); } - return redirect() - ->route('bo.texts.edit', $text->id) + return to_route('bo.texts.edit', $text->id) ->with('success', 'Question/réponse créée !'); } @@ -80,11 +78,11 @@ class TextsController extends Controller $text->fill($request->validated()); if (!$text->saveOrFail()) { - return redirect()->route('bo.texts.edit', $text->id) + return to_route('bo.texts.edit', $text->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.texts.edit', $text->id) + return to_route('bo.texts.edit', $text->id) ->with('success', trans('Modifications enregistrées !')); } @@ -97,11 +95,11 @@ class TextsController extends Controller public function destroy(Text $text) { if (!$text->delete()) { - return redirect()->route('bo.texts.content', $text->page) + return to_route('bo.texts.content', $text->page) ->with('error', trans('La suppression a échoué')); } - return redirect()->route('bo.texts.content', $text->page) + return to_route('bo.texts.content', $text->page) ->with('success', trans('Suppression faite avec succès')); } } diff --git a/app/Http/Controllers/Bo/TitlesController.php b/app/Http/Controllers/Bo/TitlesController.php index e75cded..1781d9f 100644 --- a/app/Http/Controllers/Bo/TitlesController.php +++ b/app/Http/Controllers/Bo/TitlesController.php @@ -33,11 +33,11 @@ class TitlesController extends Controller $title->fill($request->validated()); if (!$title->saveOrFail()) { - return redirect()->route('bo.titles.edit', $title->id) + return to_route('bo.titles.edit', $title->id) ->with('error', trans('La modification a échoué')); } - return redirect()->route('bo.titles.edit', $title->id) + return to_route('bo.titles.edit', $title->id) ->with('success', trans('Modifications enregistrées !')); } } diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index fc7d95a..7fbc44f 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -18,13 +18,9 @@ class ContactController extends Controller */ public function contact() { - $listCountries = Cache::remember('listCountries', 86400, function () { - return Country::toArray(); - }); + $listCountries = Cache::remember('listCountries', 86400, fn() => Country::toArray()); - $listDeps = Cache::remember('listDeps', 86400, function () { - return Department::toArray(); - }); + $listDeps = Cache::remember('listDeps', 86400, fn() => Department::toArray()); return view('front.contact', compact('listCountries', 'listDeps')); } @@ -47,7 +43,7 @@ class ContactController extends Controller Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($data->all())); $lang = session()->get('lang', config('app.locale')); - return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact") + return to_route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact") ->with('status', true); } } diff --git a/app/Http/Controllers/GammesController.php b/app/Http/Controllers/GammesController.php index 1525d38..66a217f 100644 --- a/app/Http/Controllers/GammesController.php +++ b/app/Http/Controllers/GammesController.php @@ -45,7 +45,7 @@ class GammesController extends Controller foreach ($dbGammes as $dbGamme) { $gammes->push($dbGamme->id); $dbGamme->childGammes->sortBy('title') - ->map(function (Gamme $childGamme) use (&$gammes) { + ->map(function (Gamme $childGamme) use (&$gammes): void { $gammes->push($childGamme->id); }); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index fef0541..56f138e 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -26,15 +26,15 @@ class HomeController extends Controller $slider = Slider::where('published', 1)->first(); if ($slider) { - $slides = Slide::whereHas('slider', function ($q) use ($slider) { + $slides = Slide::whereHas('slider', function (\Illuminate\Contracts\Database\Query\Builder $q) use ($slider): void { $q->whereId($slider->id); - })->where(function ($q) { + })->where(function ($q): void { $q->where( - function ($q) { - $q->where('date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')) - ->where('date_end', '>', Carbon::now()->format('Y-m-d H:i:s')); + function ($q): void { + $q->where('date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')) + ->where('date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')); } - )->orWhere(function ($q) { + )->orWhere(function ($q): void { $q->whereNull('date_start') ->whereNull('date_end'); }); @@ -47,8 +47,8 @@ class HomeController extends Controller $encart_home = Encart::where('page', Page::homeHeader()->value)->first(); $post_home = Post::where([ - ['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')], - ['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')], + ['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')], + ['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')], ['on_top', true] ])->first(); // Limitation à 3 produits affichés sur la homepage. diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php index 0d50c7b..0d22a81 100644 --- a/app/Http/Controllers/NewsController.php +++ b/app/Http/Controllers/NewsController.php @@ -28,8 +28,8 @@ class NewsController extends Controller $title_newsPosts = Title::where('page', Page::newsPosts()->value)->first(); $posts = Post::where([ - ['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')], - ['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')], + ['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')], + ['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')], ]) ->orderBy('created_at', 'DESC') ->get(); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 98e3607..a5ad548 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -16,6 +16,7 @@ class Kernel extends HttpKernel * * @var array */ + #[\Override] protected $middleware = [ \App\Http\Middleware\TrustProxies::class, \Fruitcake\Cors\HandleCors::class, @@ -30,6 +31,7 @@ class Kernel extends HttpKernel * * @var array */ + #[\Override] protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, @@ -55,7 +57,8 @@ class Kernel extends HttpKernel * * @var array */ - protected $routeMiddleware = [ + #[\Override] + protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, diff --git a/app/Http/Middleware/AdminSecureMiddleware.php b/app/Http/Middleware/AdminSecureMiddleware.php index a2ac87f..cf4bd61 100644 --- a/app/Http/Middleware/AdminSecureMiddleware.php +++ b/app/Http/Middleware/AdminSecureMiddleware.php @@ -25,20 +25,16 @@ class AdminSecureMiddleware $client_ip = AdminSecure::fetchClientIp(); $ip_is_allowed = \collect(AdminSecure::getOptions()->getCidrList()) - ->reduce(function ($initial, $ip_range) use ($client_ip) { - return $initial || IP::contains( - $ip_range, - $client_ip - )->unwrap(); - }); + ->reduce(fn($initial, $ip_range) => $initial || IP::contains( + $ip_range, + $client_ip + )->unwrap()); $ip_is_allowed_by_config = \collect(AdminSecure::getOptions()->getCidrAllowedList()) - ->reduce(function ($initial, $ip_range) use ($client_ip) { - return $initial || IP::contains( - $ip_range, - $client_ip - )->unwrap(); - }); + ->reduce(fn($initial, $ip_range) => $initial || IP::contains( + $ip_range, + $client_ip + )->unwrap()); if ($ip_is_allowed or $ip_is_allowed_by_config or AdminSecure::ipIsPrivate($client_ip)) { return $next($request); diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 20c5039..4cebcfe 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -11,6 +11,7 @@ class EncryptCookies extends Middleware * * @var array */ + #[\Override] protected $except = [ ]; } diff --git a/app/Http/Middleware/FrontEndGlobals.php b/app/Http/Middleware/FrontEndGlobals.php index a7c001d..1c0e681 100644 --- a/app/Http/Middleware/FrontEndGlobals.php +++ b/app/Http/Middleware/FrontEndGlobals.php @@ -25,9 +25,9 @@ class FrontEndGlobals $routeParamsFR = Route::current()->parameters(); $routeParamsEN = $routeParamsFR; $routeParamsES = $routeParamsFR; - array_walk($routeParamsFR, array($this, 'unbind'), ''); - array_walk($routeParamsEN, array($this, 'unbind'), 'en'); - array_walk($routeParamsES, array($this, 'unbind'), 'es'); + array_walk($routeParamsFR, $this->unbind(...), ''); + array_walk($routeParamsEN, $this->unbind(...), 'en'); + array_walk($routeParamsES, $this->unbind(...), 'es'); if (preg_match('/^(en|es)/', $currentRoute)) { $currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1); $currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1); diff --git a/app/Http/Middleware/LangCheck.php b/app/Http/Middleware/LangCheck.php index f936b0d..b12a068 100644 --- a/app/Http/Middleware/LangCheck.php +++ b/app/Http/Middleware/LangCheck.php @@ -41,9 +41,9 @@ class LangCheck if ($this->checkFirstAccess($request)) { $sess_lang = $request->session()->get('lang', config('app.locale')); if ($sess_lang === config('app.locale')) { - return redirect()->route($routName, $request->route()->parameters()); + return to_route($routName, $request->route()->parameters()); } - return redirect()->route($sess_lang . '.' . $routName, $request->route()->parameters()); + return to_route($sess_lang . '.' . $routName, $request->route()->parameters()); } $this->saveUserLocale( config('app.locale'), @@ -88,7 +88,7 @@ class LangCheck */ private function checkFirstAccess(Request $request) { - if (\strpos($request->header('User-Agent'), "Uptime-Kuma") !== false) { + if (str_contains($request->header('User-Agent'), "Uptime-Kuma")) { return false; } // Do we have session ? diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index 402ea32..8eb9e81 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -11,6 +11,7 @@ class PreventRequestsDuringMaintenance extends Middleware * * @var array */ + #[\Override] protected $except = [ ]; } diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index a8a252d..29d6d6d 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -11,6 +11,7 @@ class TrimStrings extends Middleware * * @var array */ + #[\Override] protected $except = [ 'current_password', 'password', diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 124b191..23d9b7c 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -12,6 +12,7 @@ class TrustProxies extends Middleware * * @var array|string|null */ + #[\Override] protected $proxies; /** @@ -19,6 +20,7 @@ class TrustProxies extends Middleware * * @var integer */ + #[\Override] protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index ed591f2..d8acf08 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -4,13 +4,14 @@ namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; -class VerifyCsrfToken extends Middleware +class VerifyCsrfToken extends \Illuminate\Foundation\Http\Middleware\PreventRequestForgery { /** * The URIs that should be excluded from CSRF verification. * * @var array */ + #[\Override] protected $except = [ ]; } diff --git a/app/Http/Requests/StorePostRequest.php b/app/Http/Requests/StorePostRequest.php index 49f8324..a034c10 100644 --- a/app/Http/Requests/StorePostRequest.php +++ b/app/Http/Requests/StorePostRequest.php @@ -30,11 +30,11 @@ class StorePostRequest extends FormRequest { try { $this->merge([ - 'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(), - 'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(), + 'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(), + 'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(), 'on_top' => $this->on_top ? true : false, ]); - } catch (InvalidFormatException $e) { + } catch (InvalidFormatException) { $error = ValidationException::withMessages([ 'date_start_date' => ['Format de date incorrect'], 'date_end_date' => ['Format de date incorrect'], @@ -58,13 +58,13 @@ class StorePostRequest extends FormRequest 'date_start' => [ 'required', 'date_format:Y-m-d H:i:s', - 'before:' . Carbon::now()->parse('2037-12-31') + 'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31') ], 'date_end' => [ 'required', 'date_format:Y-m-d H:i:s', 'after:date_start', - 'before:' . Carbon::now()->parse('2037-12-31') + 'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31') ], 'picture_home' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=1030,max_height=239', 'alt_text_picture_home' => 'required|max:255', diff --git a/app/Http/Requests/StoreProductRequest.php b/app/Http/Requests/StoreProductRequest.php index fe831dd..787d836 100644 --- a/app/Http/Requests/StoreProductRequest.php +++ b/app/Http/Requests/StoreProductRequest.php @@ -26,78 +26,78 @@ class StoreProductRequest extends FormRequest */ protected function prepareForValidation() { - $tabFour = array( + $tabFour = [ 'id' => 0, 'name' => 'Four', 'url' => '/assets/images/four.png', 'time' => $this->time_cook0, 'temp' => $this->temp_cook0, 'status' => $this->is_activated0 ? true : false - ); - $tabFriteuse = array( + ]; + $tabFriteuse = [ 'id' => 1, 'name' => 'Friteuse', 'url' => '/assets/images/friteuse.png', 'time' => $this->time_cook1, 'temp' => $this->temp_cook1, 'status' => $this->is_activated1 ? true : false - ); - $tabPoele = array( + ]; + $tabPoele = [ 'id' => 2, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', 'time' => $this->time_cook2, 'temp' => $this->temp_cook2, 'status' => $this->is_activated2 ? true : false - ); - $tabCocotte = array( + ]; + $tabCocotte = [ 'id' => 3, 'name' => 'Cocotte', 'url' => '/assets/images/cocotte.png', 'time' => $this->time_cook3, 'temp' => $this->temp_cook3, 'status' => $this->is_activated3 ? true : false - ); - $tabPlancha = array( + ]; + $tabPlancha = [ 'id' => 4, 'name' => 'Plancha', 'url' => '/assets/images/plancha.png', 'time' => $this->time_cook4, 'temp' => $this->temp_cook4, 'status' => $this->is_activated4 ? true : false - ); - $tabBainMarie = array( + ]; + $tabBainMarie = [ 'id' => 5, 'name' => 'Bain Marie', 'url' => '/assets/images/bainmarie.png', 'time' => $this->time_cook5, 'temp' => $this->temp_cook5, 'status' => $this->is_activated5 ? true : false - ); - $tabBarbecue = array( + ]; + $tabBarbecue = [ 'id' => 6, 'name' => 'Barbecue', 'url' => '/assets/images/barbecue.png', 'time' => $this->time_cook6, 'temp' => $this->temp_cook6, 'status' => $this->is_activated6 ? true : false - ); - $tabMicroOndes = array( + ]; + $tabMicroOndes = [ 'id' => 7, 'name' => 'Micro Ondes', 'url' => '/assets/images/micro-onde.png', 'time' => $this->time_cook7, 'temp' => $this->temp_cook7, 'status' => $this->is_activated7 ? true : false - ); - $tabCasserole = array( + ]; + $tabCasserole = [ 'id' => 8, 'name' => 'Casserole', 'url' => '/assets/images/casserole.png', 'time' => $this->time_cook8, 'temp' => $this->temp_cook8, 'status' => $this->is_activated8 ? true : false - ); + ]; $tabCuisson = json_encode([ 'four' => $tabFour, 'friteuse' => $tabFriteuse, @@ -114,29 +114,29 @@ class StoreProductRequest extends FormRequest if ($this->pictogramme0) { $urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName(); } - $tabPlusProduit1 = array( + $tabPlusProduit1 = [ 'id' => 0, 'name' => $this->content0, 'url' => $urlPlusProduit, - ); + ]; $urlPlusProduit = ""; if ($this->pictogramme1) { $urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName(); } - $tabPlusProduit2 = array( + $tabPlusProduit2 = [ 'id' => 1, 'name' => $this->content1, 'url' => $urlPlusProduit, - ); + ]; $urlPlusProduit = ""; if ($this->pictogramme2) { $urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName(); } - $tabPlusProduit3 = array( + $tabPlusProduit3 = [ 'id' => 2, 'name' => $this->content2, 'url' => $urlPlusProduit, - ); + ]; $tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]); $this->merge([ 'slug' => Str::slug($this->name), diff --git a/app/Http/Requests/StoreSlideRequest.php b/app/Http/Requests/StoreSlideRequest.php index 309b83e..6e918fb 100644 --- a/app/Http/Requests/StoreSlideRequest.php +++ b/app/Http/Requests/StoreSlideRequest.php @@ -29,10 +29,10 @@ class StoreSlideRequest extends FormRequest { try { $this->merge([ - 'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(), - 'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(), + 'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(), + 'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(), ]); - } catch (InvalidFormatException $e) { + } catch (InvalidFormatException) { $error = \Illuminate\Validation\ValidationException::withMessages([ 'date_start_date' => ['Format de date incorrect'], 'date_end_date' => ['Format de date incorrect'], @@ -40,8 +40,8 @@ class StoreSlideRequest extends FormRequest throw $error; } $this->merge([ - 'title' => 'lorem title ' . rand(), - 'text' => 'lorem text ' . rand(), + 'title' => 'lorem title ' . random_int(0, mt_getrandmax()), + 'text' => 'lorem text ' . random_int(0, mt_getrandmax()), 'link_new_tab' => $this->link_new_tab ? true : false ]); } @@ -65,13 +65,13 @@ class StoreSlideRequest extends FormRequest 'date_start' => [ 'nullable', 'date_format:Y-m-d H:i:s', - 'before:' . Carbon::now()->parse('2037-12-31') + 'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31') ], 'date_end' => [ 'nullable', 'date_format:Y-m-d H:i:s', 'after:date_start', - 'before:' . Carbon::now()->parse('2037-12-31') + 'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31') ], ]; } diff --git a/app/Lib/AdminSecure.php b/app/Lib/AdminSecure.php index cc05a57..f252904 100644 --- a/app/Lib/AdminSecure.php +++ b/app/Lib/AdminSecure.php @@ -58,7 +58,7 @@ abstract class AdminSecure */ public static function ipIsPrivate($ip_address): bool { - return \get_class($ip_address) === IPv4Address::class ? + return $ip_address::class === IPv4Address::class ? self::ipV4IsPrivate($ip_address) : self::ipV6IsPrivate($ip_address); } @@ -90,12 +90,8 @@ abstract class AdminSecure { return \collect(self::$private_ip_v4_cidr_list) ->concat([self::$private_ip_v4_loopback_cidr]) - ->map(function (string $ipv4_cidr) { - return IPv4Range::Make($ipv4_cidr)->unwrap(); - }) - ->reduce(function ($initial, IPv4Range $ipv4_range) use ($ipv4_address) { - return $initial || $ipv4_range->containsAddress($ipv4_address); - }); + ->map(fn(string $ipv4_cidr) => IPv4Range::Make($ipv4_cidr)->unwrap()) + ->reduce(fn($initial, IPv4Range $ipv4_range) => $initial || $ipv4_range->containsAddress($ipv4_address)); } /** @@ -108,12 +104,8 @@ abstract class AdminSecure { return \collect(self::$private_ip_v6_cidr_list) ->concat([self::$private_ip_v6_loopback_cidr]) - ->map(function (string $ipv6_cidr) { - return IPv6Range::Make($ipv6_cidr)->unwrap(); - }) - ->reduce(function ($initial, IPv6Range $ipv6_range) { - return $initial || $ipv6_range->containsAddress($ipv6_address); - }); + ->map(fn(string $ipv6_cidr) => IPv6Range::Make($ipv6_cidr)->unwrap()) + ->reduce(fn($initial, IPv6Range $ipv6_range) => $initial || $ipv6_range->containsAddress($ipv6_address)); } /** diff --git a/app/Lib/Helpers/ExceptionsHelper.php b/app/Lib/Helpers/ExceptionsHelper.php index 11a829b..7b0ec22 100644 --- a/app/Lib/Helpers/ExceptionsHelper.php +++ b/app/Lib/Helpers/ExceptionsHelper.php @@ -170,19 +170,12 @@ class ExceptionsHelper $argsCount = count($stack['args']); for ($i = 0; $i < $argsCount; $i++) { $type = \gettype($stack['args'][$i]); - switch ($type) { - case 'object': - $traceArgs .= sprintf('Object(%s)', \get_class($stack['args'][$i])); - break; - case 'array': - $traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i])); - break; - case 'string': - $traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i])); - break; - default: - $traceArgs .= \gettype($stack['args'][$i]); - } + match ($type) { + 'object' => $traceArgs .= sprintf('Object(%s)', $stack['args'][$i]::class), + 'array' => $traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i])), + 'string' => $traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i])), + default => $traceArgs .= \gettype($stack['args'][$i]), + }; $traceArgs .= ($i !== ($argsCount - 1) ? ',' : ''); } return $traceArgs; diff --git a/app/Lib/Helpers/ToolboxHelper.php b/app/Lib/Helpers/ToolboxHelper.php index 7cce240..a91b24d 100644 --- a/app/Lib/Helpers/ToolboxHelper.php +++ b/app/Lib/Helpers/ToolboxHelper.php @@ -22,40 +22,30 @@ class ToolboxHelper 'g-recaptcha-response' => [ 'required', 'string', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed - function ($attribute, $value, $fail) use ($isV3) { + function ($attribute, $value, $fail) use ($isV3): void { try { $response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [ 'secret' => config('services.google.recaptcha.private'), 'response' => \strval($value), - 'remoteip' => app('clientIp') + 'remoteip' => resolve('clientIp') ]); - if ($e = $response->toException()) { - throw $e; - } + throw_if($e = $response->toException(), $e); if ($isV3) { - if ( - !$response->json('success') or - !$response->json('challenge_ts') or - Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or - $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or - !$response->json('score') - ) { - throw new \RuntimeException(); - } + throw_if(!$response->json('success') or + !$response->json('challenge_ts') or + \Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or + $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or + !$response->json('score'), \RuntimeException::class); if (\floatval($response->json('score')) < 0.8) { $fail("Vous n'avez pas obtenu un score assez élevé lors de la validation du recaptcha"); } return; } - if ( - !$response->json('success') or - !$response->json('challenge_ts') or - Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or - $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) - ) { - throw new \RuntimeException(); - } - } catch (\Exception $e) { + throw_if(!$response->json('success') or + !$response->json('challenge_ts') or + \Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or + $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST), \RuntimeException::class); + } catch (\Exception) { $fail('Erreur lors de la validation du formulaire veuillez réssayer'); } //end try } diff --git a/app/Lib/Options.php b/app/Lib/Options.php index b627087..8a4d3b1 100644 --- a/app/Lib/Options.php +++ b/app/Lib/Options.php @@ -78,8 +78,8 @@ final class Options 'cidrProjectAllowedList' => [] ]); - $resolver->setNormalizer('cidrList', \Closure::fromCallable([$this, 'normalizeCidrList'])); - $resolver->setNormalizer('cidrProjectAllowedList', \Closure::fromCallable([$this, 'normalizeCidrProjectList'])); + $resolver->setNormalizer('cidrList', $this->normalizeCidrList(...)); + $resolver->setNormalizer('cidrProjectAllowedList', $this->normalizeCidrProjectList(...)); } /** @@ -149,11 +149,9 @@ final class Options } /** @var array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range> $allowed_cidr_list */ - return \collect(Cache::rememberForever($cacheConfigKey, function() use ($allowed_cidr_list, $allowed_cidr_config_list_hash) { - return [ - 'list' => $allowed_cidr_list, - 'hash' => $allowed_cidr_config_list_hash - ]; - }))->get('list'); + return \collect(Cache::rememberForever($cacheConfigKey, fn() => [ + 'list' => $allowed_cidr_list, + 'hash' => $allowed_cidr_config_list_hash + ]))->get('list'); } } diff --git a/app/Lib/Utils.php b/app/Lib/Utils.php index 5b87098..4f88b9e 100644 --- a/app/Lib/Utils.php +++ b/app/Lib/Utils.php @@ -29,7 +29,7 @@ class Utils */ public static function storeImage($image, string $folderName): string { - if (\is_object($image) and get_class($image) === UploadedFile::class) { + if (\is_object($image) and $image::class === UploadedFile::class) { /** @var UploadedFile */ $image = $image; $newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName); @@ -37,7 +37,7 @@ class Utils $image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME)); return '/storage' . str_replace('/public', '', $newPath); } - if (\is_object($image) and get_class($image) === SplFileInfo::class) { + if (\is_object($image) and $image::class === SplFileInfo::class) { /** @var SplFileInfo */ $image = $image; $newPath = self::prepareMoveFile($image->getBaseName(), $folderName); diff --git a/app/Models/Advice.php b/app/Models/Advice.php index 4313c19..aa3a4c9 100644 --- a/app/Models/Advice.php +++ b/app/Models/Advice.php @@ -18,6 +18,7 @@ class Advice extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title1', 'title2', @@ -57,7 +58,7 @@ class Advice extends Model */ protected static function boot() { - static::creating(function (Advice $advice) { + static::creating(function (Advice $advice): void { if (is_a($advice->picture1, "SplFileInfo")) { $advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable()); } @@ -69,7 +70,7 @@ class Advice extends Model } }); - static::updating(function (Advice $advice) { + static::updating(function (Advice $advice): void { if (is_a($advice->picture1, "SplFileInfo")) { $advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable()); } @@ -81,7 +82,7 @@ class Advice extends Model } }); - static::deleted(function (Advice $advice) { + static::deleted(function (Advice $advice): void { if ($advice->picture1) { $urlPicture = public_path() . $advice->picture1; if ($urlPicture) { diff --git a/app/Models/Encart.php b/app/Models/Encart.php index 1ea0d58..257aa02 100644 --- a/app/Models/Encart.php +++ b/app/Models/Encart.php @@ -28,6 +28,7 @@ class Encart extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'subtitle', @@ -56,19 +57,19 @@ class Encart extends Model */ protected static function boot() { - static::creating(function (Encart $encart) { + static::creating(function (Encart $encart): void { if (is_a($encart->picture, "SplFileInfo")) { $encart->picture = Utils::storeImage($encart->picture, $encart->getTable()); } }); - static::updating(function (Encart $encart) { + static::updating(function (Encart $encart): void { if (is_a($encart->picture, "SplFileInfo")) { $encart->picture = Utils::storeImage($encart->picture, $encart->getTable()); } }); - static::deleted(function (Encart $encart) { + static::deleted(function (Encart $encart): void { if ($encart->picture) { $urlPicture = public_path() . $encart->picture; if ($urlPicture) { diff --git a/app/Models/Gamme.php b/app/Models/Gamme.php index d0ab6b0..ac664b4 100644 --- a/app/Models/Gamme.php +++ b/app/Models/Gamme.php @@ -18,6 +18,7 @@ class Gamme extends Model * * @var array */ + #[\Override] protected $fillable = [ 'parent_gamme_id', 'title', @@ -53,7 +54,7 @@ class Gamme extends Model */ protected static function boot() { - static::creating(function (Gamme $gamme) { + static::creating(function (Gamme $gamme): void { if (is_a($gamme->picture, "SplFileInfo")) { $gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable()); } @@ -67,7 +68,7 @@ class Gamme extends Model } }); - static::updating(function (Gamme $gamme) { + static::updating(function (Gamme $gamme): void { if (is_a($gamme->picture, "SplFileInfo")) { $gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable()); } @@ -93,14 +94,14 @@ class Gamme extends Model } }); - static::deleting(function (Gamme $gamme) { + static::deleting(function (Gamme $gamme): void { if ($gamme->childGammes()->exists()) { Gamme::whereParentGammeId($gamme->id) ->update(['parent_gamme_id' => null]); } }); - static::deleted(function (Gamme $gamme) { + static::deleted(function (Gamme $gamme): void { if ($gamme->picture) { $urlPicture = public_path() . $gamme->picture; if ($urlPicture) { @@ -126,7 +127,7 @@ class Gamme extends Model * * @return string */ - public function getRgbaColorAttribute() + protected function getRgbaColorAttribute() { $color = $this->color; @@ -136,7 +137,7 @@ class Gamme extends Model if ($color[0] == '#') { $color = substr($color, 1); } - list($r, $g, $b) = array_map("hexdec", str_split($color, (strlen($color) / 3))); + [$r, $g, $b] = array_map(hexdec(...), str_split($color, (strlen($color) / 3))); return "rgba($r,$g,$b,1)"; } diff --git a/app/Models/Moment.php b/app/Models/Moment.php index aa7008b..8bc706f 100644 --- a/app/Models/Moment.php +++ b/app/Models/Moment.php @@ -28,6 +28,7 @@ class Moment extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'subtitle', @@ -56,19 +57,19 @@ class Moment extends Model */ protected static function boot() { - static::creating(function (Moment $moment) { + static::creating(function (Moment $moment): void { if (is_a($moment->picture, "SplFileInfo")) { $moment->picture = Utils::storeImage($moment->picture, $moment->getTable()); } }); - static::updating(function (Moment $moment) { + static::updating(function (Moment $moment): void { if (is_a($moment->picture, "SplFileInfo")) { $moment->picture = Utils::storeImage($moment->picture, $moment->getTable()); } }); - static::deleted(function (Moment $moment) { + static::deleted(function (Moment $moment): void { if ($moment->picture) { $urlPicture = public_path() . $moment->picture; if ($urlPicture) { diff --git a/app/Models/Picto.php b/app/Models/Picto.php index 98d606b..20f6754 100644 --- a/app/Models/Picto.php +++ b/app/Models/Picto.php @@ -28,6 +28,7 @@ class Picto extends Model * * @var array */ + #[\Override] protected $fillable = [ 'picture', 'alt_text_picture', @@ -52,19 +53,19 @@ class Picto extends Model */ protected static function boot() { - static::creating(function (Picto $picto) { + static::creating(function (Picto $picto): void { if (is_a($picto->picture, "SplFileInfo")) { $picto->picture = Utils::storeImage($picto->picture, $picto->getTable()); } }); - static::updating(function (Picto $picto) { + static::updating(function (Picto $picto): void { if (is_a($picto->picture, "SplFileInfo")) { $picto->picture = Utils::storeImage($picto->picture, $picto->getTable()); } }); - static::deleted(function (Picto $picto) { + static::deleted(function (Picto $picto): void { if ($picto->picture) { $urlPicture = public_path() . $picto->picture; if ($urlPicture) { diff --git a/app/Models/PictoBrand.php b/app/Models/PictoBrand.php index c6eafd8..31e08be 100644 --- a/app/Models/PictoBrand.php +++ b/app/Models/PictoBrand.php @@ -18,6 +18,7 @@ class PictoBrand extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'picture', @@ -44,19 +45,19 @@ class PictoBrand extends Model */ protected static function boot() { - static::creating(function (PictoBrand $pictoBrand) { + static::creating(function (PictoBrand $pictoBrand): void { if (is_a($pictoBrand->picture, "SplFileInfo")) { $pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable()); } }); - static::updating(function (PictoBrand $pictoBrand) { + static::updating(function (PictoBrand $pictoBrand): void { if (is_a($pictoBrand->picture, "SplFileInfo")) { $pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable()); } }); - static::deleted(function (PictoBrand $pictoBrand) { + static::deleted(function (PictoBrand $pictoBrand): void { if ($pictoBrand->picture) { $urlPicture = public_path() . $pictoBrand->picture; if ($urlPicture) { diff --git a/app/Models/Post.php b/app/Models/Post.php index 00903d6..4371911 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -18,6 +18,7 @@ class Post extends Model * * @var array */ + #[\Override] protected $casts = [ 'date_start' => 'datetime', 'date_end' => 'datetime', @@ -28,6 +29,7 @@ class Post extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'text', @@ -62,7 +64,7 @@ class Post extends Model */ protected static function boot() { - static::creating(function (Post $post) { + static::creating(function (Post $post): void { if (is_a($post->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($post->picture_home, $post->getTable()); } @@ -71,7 +73,7 @@ class Post extends Model } }); - static::updating(function (Post $post) { + static::updating(function (Post $post): void { if (is_a($post->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($post->picture_home, $post->getTable()); } @@ -80,7 +82,7 @@ class Post extends Model } }); - static::deleted(function (Post $post) { + static::deleted(function (Post $post): void { if ($post->picture_home) { $urlPicture = public_path() . $post->picture_home; if ($urlPicture) { diff --git a/app/Models/Product.php b/app/Models/Product.php index e687e93..12b776d 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -18,6 +18,7 @@ class Product extends Model * * @var array */ + #[\Override] protected $fillable = [ 'gamme_id', 'name', @@ -60,19 +61,19 @@ class Product extends Model */ protected static function boot() { - static::creating(function (Product $product) { + static::creating(function (Product $product): void { if (is_a($product->picture, "SplFileInfo")) { $product->picture = Utils::storeImage($product->picture, $product->getTable()); } }); - static::updating(function (Product $product) { + static::updating(function (Product $product): void { if (is_a($product->picture, "SplFileInfo")) { $product->picture = Utils::storeImage($product->picture, $product->getTable()); } }); - static::deleted(function (Product $product) { + static::deleted(function (Product $product): void { if ($product->picture) { $urlPicture = public_path() . $product->picture; if ($urlPicture) { diff --git a/app/Models/SeoDatum.php b/app/Models/SeoDatum.php index 5efb675..589f5a1 100644 --- a/app/Models/SeoDatum.php +++ b/app/Models/SeoDatum.php @@ -26,6 +26,7 @@ class SeoDatum extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'description', diff --git a/app/Models/Slide.php b/app/Models/Slide.php index 86687b0..3668353 100644 --- a/app/Models/Slide.php +++ b/app/Models/Slide.php @@ -18,6 +18,7 @@ class Slide extends Model * * @var array */ + #[\Override] protected $casts = [ 'date_start' => 'datetime', 'date_end' => 'datetime', @@ -28,6 +29,7 @@ class Slide extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'text', @@ -62,19 +64,19 @@ class Slide extends Model */ protected static function boot() { - static::creating(function (Slide $slide) { + static::creating(function (Slide $slide): void { if (is_a($slide->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); - static::updating(function (Slide $slide) { + static::updating(function (Slide $slide): void { if (is_a($slide->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); - static::deleted(function (Slide $slide) { + static::deleted(function (Slide $slide): void { if ($slide->picture) { $urlPicture = public_path() . $slide->picture; if ($urlPicture) { diff --git a/app/Models/Slider.php b/app/Models/Slider.php index 260c0a0..798ad34 100644 --- a/app/Models/Slider.php +++ b/app/Models/Slider.php @@ -17,6 +17,7 @@ class Slider extends Model * * @var array */ + #[\Override] protected $fillable = [ 'label', 'slug', @@ -52,12 +53,12 @@ class Slider extends Model */ public function showableSlides() { - $now = Carbon::now(); + $now = \Illuminate\Support\Facades\Date::now(); return $this->hasMany(Slide::class, 'slider_id') - ->orderBy('order', 'ASC')->where(function ($q) use ($now) { + ->orderBy('order', 'ASC')->where(function ($q) use ($now): void { $q->whereDate('date_start', '<=', $now) ->orWhereNull('date_start'); - })->where(function ($q) use ($now) { + })->where(function ($q) use ($now): void { $q->whereDate('date_end', '>=', $now) ->orWhereNull('date_end'); }); diff --git a/app/Models/Text.php b/app/Models/Text.php index e5a1edc..61f0b8c 100644 --- a/app/Models/Text.php +++ b/app/Models/Text.php @@ -26,6 +26,7 @@ class Text extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'text', diff --git a/app/Models/Title.php b/app/Models/Title.php index 0288d7d..98d31c5 100644 --- a/app/Models/Title.php +++ b/app/Models/Title.php @@ -26,6 +26,7 @@ class Title extends Model * * @var array */ + #[\Override] protected $fillable = [ 'title', 'text', diff --git a/app/Models/User.php b/app/Models/User.php index d1fc5a7..34b49ff 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -29,6 +29,7 @@ class User extends Authenticatable * * @var string[] */ + #[\Override] protected $fillable = [ 'name', 'email', @@ -40,6 +41,7 @@ class User extends Authenticatable * * @var array */ + #[\Override] protected $hidden = [ 'password', 'remember_token', @@ -50,6 +52,7 @@ class User extends Authenticatable * * @var array */ + #[\Override] protected $casts = [ 'email_verified_at' => 'datetime', ]; @@ -61,13 +64,13 @@ class User extends Authenticatable */ protected static function boot() { - static::creating(function (User $user) { + static::creating(function (User $user): void { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } }); - static::updating(function (User $user) { + static::updating(function (User $user): void { if (Hash::needsRehash($user->password)) { $user->password = Hash::make($user->password); } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 3ffc67d..d261094 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -11,6 +11,7 @@ class AuthServiceProvider extends ServiceProvider * * @var array */ + #[\Override] protected $policies = []; /** diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 89dff61..828884f 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -13,6 +13,7 @@ class EventServiceProvider extends ServiceProvider * * @var array */ + #[\Override] protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index a518879..f8da298 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider */ public function boot() { - $this->routes(function () { + $this->routes(function (): void { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web.php')); @@ -37,7 +37,7 @@ class RouteServiceProvider extends ServiceProvider $vars = $this->getRouteBinderVars($value); \extract($vars); /** @var \App\Models\Gamme */ - $gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value) { + $gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value): void { $q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'") ->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'"); })->firstOrFail(); @@ -52,7 +52,7 @@ class RouteServiceProvider extends ServiceProvider $vars = $this->getRouteBinderVars($value); \extract($vars); /** @var \App\Models\Product */ - $product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value) { + $product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value): void { $q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'") ->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'"); })->where('gamme_id', $gamme->id) diff --git a/bootstrap/app.php b/bootstrap/app.php index 037e17d..68536b9 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -12,7 +12,7 @@ */ $app = new Illuminate\Foundation\Application( - $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) + \Illuminate\Support\Env::get('APP_BASE_PATH', dirname(__DIR__)) ); /* diff --git a/composer.json b/composer.json index 098f573..c8c8e62 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "uwil/k8s-laravel": "^1.2" }, "require-dev": { + "driftingly/rector-laravel": "^2.5", "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laravel-lang/lang": "^10.9", @@ -32,6 +33,7 @@ "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^5.10", "phpunit/phpunit": "^9.5.10", + "rector/rector": "^2.8", "slevomat/coding-standard": "^8.5" }, "autoload": { diff --git a/composer.lock b/composer.lock index a8587eb..ef40be1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bf80b4c19ea353a96fe885a27183dea9", + "content-hash": "ba2caf5f0d1e4c429b3fbaceba79a084", "packages": [ { "name": "asm89/stack-cors", @@ -7398,6 +7398,42 @@ ], "time": "2022-04-01T17:14:16+00:00" }, + { + "name": "driftingly/rector-laravel", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/driftingly/rector-laravel.git", + "reference": "0dbdd842dfdbc821cfe5f47ca7326e2502b2a107" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/0dbdd842dfdbc821cfe5f47ca7326e2502b2a107", + "reference": "0dbdd842dfdbc821cfe5f47ca7326e2502b2a107", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "rector/rector": "^2.2.7", + "webmozart/assert": "^1.11 || ^2.0" + }, + "type": "rector-extension", + "autoload": { + "psr-4": { + "RectorLaravel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Rector upgrades rules for Laravel Framework", + "support": { + "issues": "https://github.com/driftingly/rector-laravel/issues", + "source": "https://github.com/driftingly/rector-laravel/tree/2.5.0" + }, + "time": "2026-06-02T16:22:14+00:00" + }, { "name": "facade/flare-client-php", "version": "1.10.0", @@ -8416,6 +8452,70 @@ }, "time": "2024-10-13T11:25:22+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.3.2", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/18bc23a0682f08591529377d271b5c4dfe9ed1dd", + "reference": "18bc23a0682f08591529377d271b5c4dfe9ed1dd", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2026-10-24T11:36:00+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.32", @@ -8838,6 +8938,63 @@ ], "time": "2024-12-05T13:48:26+00:00" }, + { + "name": "rector/rector", + "version": "2.8.1", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "10c96546bb72b38b4e2e9960fcd3f884d7fa02eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/10c96546bb72b38b4e2e9960fcd3f884d7fa02eb", + "reference": "10c96546bb72b38b4e2e9960fcd3f884d7fa02eb", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.3.2" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.8.1" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-10-26T13:03:01+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.2", diff --git a/config/database.php b/config/database.php index ac4559f..6b87ab2 100644 --- a/config/database.php +++ b/config/database.php @@ -59,7 +59,7 @@ return [ 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + \Pdo\Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], diff --git a/config/sentry.php b/config/sentry.php index 29627fe..99a509f 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -57,5 +57,5 @@ return [ // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate. 'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'), - 'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'], + 'before_send' => \App\Lib\Helpers\ExceptionsHelper::sentryEventHandler(...), ]; diff --git a/database/factories/AdviceFactory.php b/database/factories/AdviceFactory.php index 337c91f..4dbaeb7 100644 --- a/database/factories/AdviceFactory.php +++ b/database/factories/AdviceFactory.php @@ -14,6 +14,7 @@ class AdviceFactory extends Factory * * @var string */ + #[\Override] protected $model = Advice::class; /** diff --git a/database/factories/EncartFactory.php b/database/factories/EncartFactory.php index 1f72e5d..d117d9d 100644 --- a/database/factories/EncartFactory.php +++ b/database/factories/EncartFactory.php @@ -14,6 +14,7 @@ class EncartFactory extends Factory * * @var string */ + #[\Override] protected $model = Encart::class; /** diff --git a/database/factories/GammeFactory.php b/database/factories/GammeFactory.php index 99cbfea..78a2a47 100644 --- a/database/factories/GammeFactory.php +++ b/database/factories/GammeFactory.php @@ -17,7 +17,7 @@ class GammeFactory extends Factory */ public function definition() { - $title = $this->faker->text(10) . rand(1, 100); + $title = $this->faker->text(10) . random_int(1, 100); $upload = new SplFileInfo(resource_path('assets/images/cookrange.jpg')); $picture = new Gamme(); diff --git a/database/factories/MomentFactory.php b/database/factories/MomentFactory.php index ae51971..a1a8163 100644 --- a/database/factories/MomentFactory.php +++ b/database/factories/MomentFactory.php @@ -13,6 +13,7 @@ class MomentFactory extends Factory * * @var string */ + #[\Override] protected $model = Moment::class; /** diff --git a/database/factories/PictoBrandFactory.php b/database/factories/PictoBrandFactory.php index e3da8b9..df04536 100644 --- a/database/factories/PictoBrandFactory.php +++ b/database/factories/PictoBrandFactory.php @@ -14,6 +14,7 @@ class PictoBrandFactory extends Factory * * @var string */ + #[\Override] protected $model = PictoBrand::class; /** diff --git a/database/factories/PictoFactory.php b/database/factories/PictoFactory.php index beab43e..77af676 100644 --- a/database/factories/PictoFactory.php +++ b/database/factories/PictoFactory.php @@ -14,6 +14,7 @@ class PictoFactory extends Factory * * @var string */ + #[\Override] protected $model = Picto::class; /** diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php index 4988df1..2efff91 100644 --- a/database/factories/PostFactory.php +++ b/database/factories/PostFactory.php @@ -31,8 +31,8 @@ class PostFactory extends Factory 'alt_text_picture_home' => $this->faker->sentence(10), 'picture_news' => $imgnewspath, 'alt_text_picture_news' => $this->faker->sentence(10), - 'date_start' => Carbon::now(), - 'date_end' => Carbon::now()->addDays(2), + 'date_start' => \Illuminate\Support\Facades\Date::now(), + 'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2), 'on_top' => true ]; } diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index a8ce44d..9c8b55d 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -17,94 +17,94 @@ class ProductFactory extends Factory */ public function definition() { - $name = $this->faker->text(10) . rand(1, 100); - $tabFour = array( + $name = $this->faker->text(10) . random_int(1, 100); + $tabFour = [ 'id' => 0, 'name' => 'Four', 'url' => '/assets/images/four.png', 'time' => '1h30mins.', 'temp' => '200°C', 'status' => true - ); - $tabFriteuse = array( + ]; + $tabFriteuse = [ 'id' => 1, 'name' => 'Friteuse', 'url' => '/assets/images/friteuse.png', 'time' => '15 minutes', 'temp' => '100°C', 'status' => true - ); - $tabPoele = array( + ]; + $tabPoele = [ 'id' => 2, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', 'time' => '5 minutes sur chaque face', 'temp' => '100°C', 'status' => false - ); - $tabCocotte = array( + ]; + $tabCocotte = [ 'id' => 3, 'name' => 'Cocotte', 'url' => '/assets/images/cocotte.png', 'time' => '3 h', 'temp' => '80°C', 'status' => true - ); - $tabPlancha = array( + ]; + $tabPlancha = [ 'id' => 4, 'name' => 'Plancha', 'url' => '/assets/images/plancha.png', 'time' => '20mins', 'temp' => '130°C', 'status' => false - ); - $tabBainMarie = array( + ]; + $tabBainMarie = [ 'id' => 5, 'name' => 'Bain Marie', 'url' => '/assets/images/bainmarie.png', 'time' => '30 mins à 45 mins', 'temp' => '80°C', 'status' => false - ); - $tabBarbecue = array( + ]; + $tabBarbecue = [ 'id' => 6, 'name' => 'Barbecue', 'url' => '/assets/images/barbecue.png', 'time' => '30 minutes', 'temp' => '200°C', 'status' => false - ); - $tabMicroOndes = array( + ]; + $tabMicroOndes = [ 'id' => 7, 'name' => 'Micro Ondes', 'url' => '/assets/images/microondes.png', 'time' => '3mins', 'temp' => '900 Watts', 'status' => false - ); - $tabCasserole = array( + ]; + $tabCasserole = [ 'id' => 8, 'name' => 'Casserole', 'url' => '/assets/images/casserole.png', 'time' => '10mins', 'temp' => '90°C', 'status' => false - ); - $tabPlusProduit1 = array( + ]; + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit3 = array( + ]; + $tabPlusProduit3 = [ 'id' => 2, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $upload = new SplFileInfo(resource_path('assets/images/product_sample_01.png')); $picture = new Product(); @@ -129,10 +129,10 @@ class ProductFactory extends Factory ]), 'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]), 'is_published' => true, - 'is_on_top' => rand(true, false), - 'is_news' => rand(true, false), - 'is_food_service' => rand(true, false), - 'is_halal' => rand(true, false), + 'is_on_top' => random_int(true, false), + 'is_news' => random_int(true, false), + 'is_food_service' => random_int(true, false), + 'is_halal' => random_int(true, false), 'seo_title' => $this->faker->text(5), 'seo_description' => $this->faker->sentence(20), ]; diff --git a/database/factories/SlideFactory.php b/database/factories/SlideFactory.php index 745c359..c0a63e3 100644 --- a/database/factories/SlideFactory.php +++ b/database/factories/SlideFactory.php @@ -15,6 +15,7 @@ class SlideFactory extends Factory * * @var string */ + #[\Override] protected $model = Slide::class; /** @@ -34,9 +35,9 @@ class SlideFactory extends Factory 'text' => $this->faker->realText(25), 'link_label' => $this->faker->text(128), 'link' => 'route(\'wasup\')', - 'link_new_tab' => rand(0, 1), - 'date_start' => Carbon::now(), - 'date_end' => Carbon::now()->addDays(2), + 'link_new_tab' => random_int(0, 1), + 'date_start' => \Illuminate\Support\Facades\Date::now(), + 'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2), 'picture' => $imgpath, 'alt_text_picture' => $this->faker->sentence(10), ]; diff --git a/database/factories/SliderFactory.php b/database/factories/SliderFactory.php index cfb111e..68b2fc5 100644 --- a/database/factories/SliderFactory.php +++ b/database/factories/SliderFactory.php @@ -13,6 +13,7 @@ class SliderFactory extends Factory * * @var string */ + #[\Override] protected $model = Slider::class; /** diff --git a/database/factories/TextFactory.php b/database/factories/TextFactory.php index 419c912..cba7b64 100644 --- a/database/factories/TextFactory.php +++ b/database/factories/TextFactory.php @@ -12,6 +12,7 @@ class TextFactory extends Factory * * @var string */ + #[\Override] protected $model = Text::class; /** diff --git a/database/factories/TitleFactory.php b/database/factories/TitleFactory.php index 3399b89..ccae463 100644 --- a/database/factories/TitleFactory.php +++ b/database/factories/TitleFactory.php @@ -12,6 +12,7 @@ class TitleFactory extends Factory * * @var string */ + #[\Override] protected $model = Title::class; /** diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a3e063f..95ea288 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -13,6 +13,7 @@ class UserFactory extends Factory * * @var string */ + #[\Override] protected $model = User::class; /** @@ -40,10 +41,8 @@ class UserFactory extends Factory public function unverified() { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - return $this->state(function (array $attributes) { - return [ - 'email_verified_at' => null, - ]; - }); + return $this->state(fn(array $attributes) => [ + 'email_verified_at' => null, + ]); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index cffa33c..1b4e0dc 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateUsersTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateUsersTable extends Migration */ public function up() { - Schema::create('users', function (Blueprint $table) { + Schema::create('users', function (Blueprint $table): void { $table->id(); $table->smallInteger('role'); $table->string('name'); @@ -23,7 +23,6 @@ class CreateUsersTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -33,4 +32,4 @@ class CreateUsersTable extends Migration { Schema::dropIfExists('users'); } -} +}; diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index 0ee0a36..10eb590 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreatePasswordResetsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,13 +13,12 @@ class CreatePasswordResetsTable extends Migration */ public function up() { - Schema::create('password_resets', function (Blueprint $table) { + Schema::create('password_resets', function (Blueprint $table): void { $table->string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); } - /** * Reverse the migrations. * @@ -29,4 +28,4 @@ class CreatePasswordResetsTable extends Migration { Schema::dropIfExists('password_resets'); } -} +}; diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 6aa6d74..79f1680 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateFailedJobsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateFailedJobsTable extends Migration */ public function up() { - Schema::create('failed_jobs', function (Blueprint $table) { + Schema::create('failed_jobs', function (Blueprint $table): void { $table->id(); $table->string('uuid')->unique(); $table->text('connection'); @@ -23,7 +23,6 @@ class CreateFailedJobsTable extends Migration $table->timestamp('failed_at')->useCurrent(); }); } - /** * Reverse the migrations. * @@ -33,4 +32,4 @@ class CreateFailedJobsTable extends Migration { Schema::dropIfExists('failed_jobs'); } -} +}; diff --git a/database/migrations/2021_04_14_115938_create_encarts_table.php b/database/migrations/2021_04_14_115938_create_encarts_table.php index 32db9c7..59d50fd 100644 --- a/database/migrations/2021_04_14_115938_create_encarts_table.php +++ b/database/migrations/2021_04_14_115938_create_encarts_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateEncartsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateEncartsTable extends Migration */ public function up() { - Schema::create('encarts', function (Blueprint $table) { + Schema::create('encarts', function (Blueprint $table): void { $table->id(); $table->smallInteger('page'); $table->text('title'); @@ -24,7 +24,6 @@ class CreateEncartsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -34,4 +33,4 @@ class CreateEncartsTable extends Migration { Schema::dropIfExists('encarts'); } -} +}; diff --git a/database/migrations/2021_04_14_115938_create_sliders_table.php b/database/migrations/2021_04_14_115938_create_sliders_table.php index 65132c5..6b18818 100644 --- a/database/migrations/2021_04_14_115938_create_sliders_table.php +++ b/database/migrations/2021_04_14_115938_create_sliders_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateSlidersTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateSlidersTable extends Migration */ public function up() { - Schema::create('sliders', function (Blueprint $table) { + Schema::create('sliders', function (Blueprint $table): void { $table->id(); $table->text('label'); $table->string('slug')->unique(); @@ -22,7 +22,6 @@ class CreateSlidersTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -32,4 +31,4 @@ class CreateSlidersTable extends Migration { Schema::dropIfExists('sliders'); } -} +}; diff --git a/database/migrations/2021_04_14_115954_create_slides_table.php b/database/migrations/2021_04_14_115954_create_slides_table.php index 45fdf3d..708f3fc 100644 --- a/database/migrations/2021_04_14_115954_create_slides_table.php +++ b/database/migrations/2021_04_14_115954_create_slides_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateSlidesTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateSlidesTable extends Migration */ public function up() { - Schema::create('slides', function (Blueprint $table) { + Schema::create('slides', function (Blueprint $table): void { $table->id(); $table->foreignId('slider_id')->default(1)->constrained('sliders'); @@ -32,7 +32,6 @@ class CreateSlidesTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -42,4 +41,4 @@ class CreateSlidesTable extends Migration { Schema::dropIfExists('slides'); } -} +}; diff --git a/database/migrations/2021_12_10_140929_create_pictos_table.php b/database/migrations/2021_12_10_140929_create_pictos_table.php index c3525ed..a0eccec 100644 --- a/database/migrations/2021_12_10_140929_create_pictos_table.php +++ b/database/migrations/2021_12_10_140929_create_pictos_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreatePictosTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreatePictosTable extends Migration */ public function up() { - Schema::create('pictos', function (Blueprint $table) { + Schema::create('pictos', function (Blueprint $table): void { $table->id(); $table->smallInteger('page'); $table->text('picture')->nullable(); @@ -22,7 +22,6 @@ class CreatePictosTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -32,4 +31,4 @@ class CreatePictosTable extends Migration { Schema::dropIfExists('pictos'); } -} +}; diff --git a/database/migrations/2021_12_10_143830_create_picto_brands_table.php b/database/migrations/2021_12_10_143830_create_picto_brands_table.php index 3b78e56..75985bb 100644 --- a/database/migrations/2021_12_10_143830_create_picto_brands_table.php +++ b/database/migrations/2021_12_10_143830_create_picto_brands_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreatePictoBrandsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreatePictoBrandsTable extends Migration */ public function up() { - Schema::create('picto_brands', function (Blueprint $table) { + Schema::create('picto_brands', function (Blueprint $table): void { $table->id(); $table->text('title'); $table->text('picture')->nullable(); @@ -22,7 +22,6 @@ class CreatePictoBrandsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -32,4 +31,4 @@ class CreatePictoBrandsTable extends Migration { Schema::dropIfExists('picto_brands'); } -} +}; diff --git a/database/migrations/2021_12_10_150259_create_titles_table.php b/database/migrations/2021_12_10_150259_create_titles_table.php index 6e35a62..3dc7c16 100644 --- a/database/migrations/2021_12_10_150259_create_titles_table.php +++ b/database/migrations/2021_12_10_150259_create_titles_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateTitlesTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateTitlesTable extends Migration */ public function up() { - Schema::create('titles', function (Blueprint $table) { + Schema::create('titles', function (Blueprint $table): void { $table->id(); $table->smallInteger('page')->unique(); $table->text('title'); @@ -21,7 +21,6 @@ class CreateTitlesTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -31,4 +30,4 @@ class CreateTitlesTable extends Migration { Schema::dropIfExists('titles'); } -} +}; diff --git a/database/migrations/2021_12_14_161711_create_texts_table.php b/database/migrations/2021_12_14_161711_create_texts_table.php index 4e93db0..d5d15ad 100644 --- a/database/migrations/2021_12_14_161711_create_texts_table.php +++ b/database/migrations/2021_12_14_161711_create_texts_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateTextsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateTextsTable extends Migration */ public function up() { - Schema::create('texts', function (Blueprint $table) { + Schema::create('texts', function (Blueprint $table): void { $table->id(); $table->smallInteger('page'); $table->text('title'); @@ -21,7 +21,6 @@ class CreateTextsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -31,4 +30,4 @@ class CreateTextsTable extends Migration { Schema::dropIfExists('texts'); } -} +}; diff --git a/database/migrations/2021_12_16_093950_create_advice_table.php b/database/migrations/2021_12_16_093950_create_advice_table.php index 15bbbb2..ea8a54c 100644 --- a/database/migrations/2021_12_16_093950_create_advice_table.php +++ b/database/migrations/2021_12_16_093950_create_advice_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateAdviceTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateAdviceTable extends Migration */ public function up() { - Schema::create('advice', function (Blueprint $table) { + Schema::create('advice', function (Blueprint $table): void { $table->id(); $table->text('title1'); $table->text('title2'); @@ -28,7 +28,6 @@ class CreateAdviceTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -38,4 +37,4 @@ class CreateAdviceTable extends Migration { Schema::dropIfExists('advice'); } -} +}; diff --git a/database/migrations/2021_12_16_131639_create_posts_table.php b/database/migrations/2021_12_16_131639_create_posts_table.php index 2599d38..00c6cf9 100644 --- a/database/migrations/2021_12_16_131639_create_posts_table.php +++ b/database/migrations/2021_12_16_131639_create_posts_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreatePostsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreatePostsTable extends Migration */ public function up() { - Schema::create('posts', function (Blueprint $table) { + Schema::create('posts', function (Blueprint $table): void { $table->id(); $table->text('title'); $table->mediumText('text'); @@ -27,7 +27,6 @@ class CreatePostsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -37,4 +36,4 @@ class CreatePostsTable extends Migration { Schema::dropIfExists('posts'); } -} +}; diff --git a/database/migrations/2021_12_20_145730_create_gammes_table.php b/database/migrations/2021_12_20_145730_create_gammes_table.php index 9983eca..7516c3d 100644 --- a/database/migrations/2021_12_20_145730_create_gammes_table.php +++ b/database/migrations/2021_12_20_145730_create_gammes_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateGammesTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateGammesTable extends Migration */ public function up() { - Schema::create('gammes', function (Blueprint $table) { + Schema::create('gammes', function (Blueprint $table): void { $table->id(); $table->foreignId('parent_gamme_id')->nullable(); $table->text('title'); @@ -27,7 +27,6 @@ class CreateGammesTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -37,4 +36,4 @@ class CreateGammesTable extends Migration { Schema::dropIfExists('gammes'); } -} +}; diff --git a/database/migrations/2021_12_22_100045_create_products_table.php b/database/migrations/2021_12_22_100045_create_products_table.php index f6cfa27..b11c6c7 100644 --- a/database/migrations/2021_12_22_100045_create_products_table.php +++ b/database/migrations/2021_12_22_100045_create_products_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateProductsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateProductsTable extends Migration */ public function up() { - Schema::create('products', function (Blueprint $table) { + Schema::create('products', function (Blueprint $table): void { $table->id(); $table->foreignId('gamme_id')->nullable(); $table->text('name'); @@ -32,7 +32,6 @@ class CreateProductsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -42,4 +41,4 @@ class CreateProductsTable extends Migration { Schema::dropIfExists('products'); } -} +}; diff --git a/database/migrations/2022_01_27_112601_create_moments_table.php b/database/migrations/2022_01_27_112601_create_moments_table.php index e130564..c7d58a6 100644 --- a/database/migrations/2022_01_27_112601_create_moments_table.php +++ b/database/migrations/2022_01_27_112601_create_moments_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateMomentsTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,7 +13,7 @@ class CreateMomentsTable extends Migration */ public function up() { - Schema::create('moments', function (Blueprint $table) { + Schema::create('moments', function (Blueprint $table): void { $table->id(); $table->smallInteger('page'); $table->text('title'); @@ -24,7 +24,6 @@ class CreateMomentsTable extends Migration $table->timestamps(); }); } - /** * Reverse the migrations. * @@ -34,4 +33,4 @@ class CreateMomentsTable extends Migration { Schema::dropIfExists('moments'); } -} +}; diff --git a/database/migrations/2022_03_11_160745_dropuniqueslug_on_products.php b/database/migrations/2022_03_11_160745_dropuniqueslug_on_products.php index e1b871c..64e47a9 100644 --- a/database/migrations/2022_03_11_160745_dropuniqueslug_on_products.php +++ b/database/migrations/2022_03_11_160745_dropuniqueslug_on_products.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class DropuniqueslugOnProducts extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,11 +13,10 @@ class DropuniqueslugOnProducts extends Migration */ public function up() { - Schema::table('products', function (Blueprint $table) { + Schema::table('products', function (Blueprint $table): void { $table->dropUnique('products_slug_unique'); }); } - /** * Reverse the migrations. * @@ -27,4 +26,4 @@ class DropuniqueslugOnProducts extends Migration { // } -} +}; diff --git a/database/migrations/2022_05_12_101807_add_is_news_on_products.php b/database/migrations/2022_05_12_101807_add_is_news_on_products.php index 79a8bbe..dbb3327 100644 --- a/database/migrations/2022_05_12_101807_add_is_news_on_products.php +++ b/database/migrations/2022_05_12_101807_add_is_news_on_products.php @@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class AddIsNewsOnProducts extends Migration +return new class extends Migration { /** * Run the migrations. @@ -13,11 +13,10 @@ class AddIsNewsOnProducts extends Migration */ public function up() { - Schema::table('products', function (Blueprint $table) { + Schema::table('products', function (Blueprint $table): void { $table->boolean('is_news')->after('is_on_top'); }); } - /** * Reverse the migrations. * @@ -25,8 +24,8 @@ class AddIsNewsOnProducts extends Migration */ public function down() { - Schema::table('products', function (Blueprint $table) { + Schema::table('products', function (Blueprint $table): void { $table->dropColumn('is_news'); }); } -} +}; diff --git a/database/migrations/2022_05_12_110531_create_seo_data_table.php b/database/migrations/2022_05_12_110531_create_seo_data_table.php index 2353c1e..c786981 100644 --- a/database/migrations/2022_05_12_110531_create_seo_data_table.php +++ b/database/migrations/2022_05_12_110531_create_seo_data_table.php @@ -5,7 +5,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -class CreateSeoDataTable extends Migration +return new class extends Migration { /** * Run the migrations. @@ -14,7 +14,7 @@ class CreateSeoDataTable extends Migration */ public function up() { - Schema::create('seo_data', function (Blueprint $table) { + Schema::create('seo_data', function (Blueprint $table): void { $table->id(); $table->smallInteger('page')->unique(); $table->text('title')->nullable(); @@ -26,7 +26,6 @@ class CreateSeoDataTable extends Migration $seeder = new SeoDataSeeder(); $seeder->run(); } - /** * Reverse the migrations. * @@ -36,4 +35,4 @@ class CreateSeoDataTable extends Migration { Schema::dropIfExists('seo_data'); } -} +}; diff --git a/database/seeders/EncartsSeeder.php b/database/seeders/EncartsSeeder.php index a881349..c024e57 100644 --- a/database/seeders/EncartsSeeder.php +++ b/database/seeders/EncartsSeeder.php @@ -26,7 +26,7 @@ class EncartsSeeder extends Seeder $i = 0; Encart::factory(6)->make() - ->each(function (Encart $encart) use ($tabEncarts, &$i) { + ->each(function (Encart $encart) use ($tabEncarts, &$i): void { $encart->page = $tabEncarts[$i++]->value; $encart->save(); }); diff --git a/database/seeders/GammesSeeder.php b/database/seeders/GammesSeeder.php index 91cae69..699bb34 100644 --- a/database/seeders/GammesSeeder.php +++ b/database/seeders/GammesSeeder.php @@ -18,93 +18,93 @@ class GammesSeeder extends Seeder */ public function run() { - $tabFour = array( + $tabFour = [ 'id' => 0, 'name' => 'Four', 'url' => '/assets/images/four.png', 'time' => '1h30mins.', 'temp' => '200°C', 'status' => true - ); - $tabFriteuse = array( + ]; + $tabFriteuse = [ 'id' => 1, 'name' => 'Friteuse', 'url' => '/assets/images/friteuse.png', 'time' => '15 minutes', 'temp' => '100°C', 'status' => true - ); - $tabPoele = array( + ]; + $tabPoele = [ 'id' => 2, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', 'time' => '5 minutes sur chaque face', 'temp' => '101°C', 'status' => true - ); - $tabCocotte = array( + ]; + $tabCocotte = [ 'id' => 3, 'name' => 'Cocotte', 'url' => '/assets/images/cocotte.png', 'time' => '3 h', 'temp' => '80°C', 'status' => false - ); - $tabPlancha = array( + ]; + $tabPlancha = [ 'id' => 4, 'name' => 'Plancha', 'url' => '/assets/images/plancha.png', 'time' => '20mins', 'temp' => '130°C', 'status' => false - ); - $tabBainMarie = array( + ]; + $tabBainMarie = [ 'id' => 5, 'name' => 'Bain Marie', 'url' => '/assets/images/bainmarie.png', 'time' => '30 mins à 45 mins', 'temp' => '80°C', 'status' => false - ); - $tabBarbecue = array( + ]; + $tabBarbecue = [ 'id' => 6, 'name' => 'Barbecue', 'url' => '/assets/images/barbecue.png', 'time' => '30 minutes', 'temp' => '200°C', 'status' => false - ); - $tabMicroOndes = array( + ]; + $tabMicroOndes = [ 'id' => 7, 'name' => 'Micro Ondes', 'url' => '/assets/images/microondes.png', 'time' => '3mins', 'temp' => '900 Watts', 'status' => false - ); - $tabCasserole = array( + ]; + $tabCasserole = [ 'id' => 8, 'name' => 'Casserole', 'url' => '/assets/images/casserole.png', 'time' => '10mins', 'temp' => '90°C', 'status' => false - ); - $tabPlusProduit1 = array( + ]; + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit3 = array( + ]; + $tabPlusProduit3 = [ 'id' => 2, 'name' => 'Lorem ipsum set doloris', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $gamme = new Gamme(); $gamme->parent_gamme_id = null; @@ -140,16 +140,16 @@ class GammesSeeder extends Seeder $gamme->alt_text_banner = $gamme->title; $gamme->save(); - $tabPlusProduit1 = array( + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'Multiplier les recettes avec ce produit : plats mijotés, hot dog, salades...', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => 'Une recette garantie sans colorant', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $product = new Product(); $product->gamme_id = $gamme->id; $product->name = 'Chicken Franks Original'; @@ -163,10 +163,10 @@ class GammesSeeder extends Seeder $product->pictos = ''; $product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]); $product->is_published = true; - $product->is_on_top = rand(true, false); - $product->is_news = rand(true, false); - $product->is_food_service = rand(true, false); - $product->is_halal = rand(true, false); + $product->is_on_top = random_int(true, false); + $product->is_news = random_int(true, false); + $product->is_food_service = random_int(true, false); + $product->is_halal = random_int(true, false); $product->seo_title = 'Chicken franks, poulet, recettes, qualité'; $product->seo_description = 'Doux vous propose des Chicken Franks Original préparées en France'; $product->save(); @@ -188,32 +188,32 @@ class GammesSeeder extends Seeder $gamme->alt_text_banner = $gamme->title; $gamme->save(); - $tabMicroOndes = array( + $tabMicroOndes = [ 'id' => 0, 'name' => 'Micro Ondes', 'url' => '/assets/images/micro-onde.png', 'time' => '3mins', 'temp' => '900 Watts', 'status' => true - ); - $tabCasserole = array( + ]; + $tabCasserole = [ 'id' => 1, 'name' => 'Casserole', 'url' => '/assets/images/casserole.png', 'time' => '5mins', 'temp' => 'Au bain marie', 'status' => true - ); - $tabPlusProduit1 = array( + ]; + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'La gourmandise à emporter partout !', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => 'Le goût fromage, le petit plus qui fait qu\'on l\'adore', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $product = new Product(); $product->gamme_id = $gamme->id; $product->name = 'Mini Chicken Franks Cheese'; @@ -230,10 +230,10 @@ class GammesSeeder extends Seeder ]); $product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]); $product->is_published = true; - $product->is_on_top = rand(true, false); - $product->is_news = rand(true, false); - $product->is_food_service = rand(true, false); - $product->is_halal = rand(true, false); + $product->is_on_top = random_int(true, false); + $product->is_news = random_int(true, false); + $product->is_food_service = random_int(true, false); + $product->is_halal = random_int(true, false); $product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise'; $product->seo_description = 'Doux vous propose des Mini Chicken Franks Cheese préparées en France'; $product->save(); @@ -260,10 +260,10 @@ class GammesSeeder extends Seeder ]); $product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]); $product->is_published = true; - $product->is_on_top = rand(true, false); - $product->is_news = rand(true, false); - $product->is_food_service = rand(true, false); - $product->is_halal = rand(true, false); + $product->is_on_top = random_int(true, false); + $product->is_news = random_int(true, false); + $product->is_food_service = random_int(true, false); + $product->is_halal = random_int(true, false); $product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise'; $product->seo_description = 'Doux vous propose des Mini Chicken Franks Cheese préparées en France'; $product->save(); @@ -284,29 +284,29 @@ class GammesSeeder extends Seeder $gamme->alt_text_banner = $gamme->title; $gamme->save(); - $tabPoele = array( + $tabPoele = [ 'id' => 0, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', 'time' => '10mins', 'temp' => '', 'status' => true - ); - $tabPlusProduit1 = array( + ]; + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'Un hachage façon bouchère pour un goût et une texture exceptionnelle !', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit2 = array( + ]; + $tabPlusProduit2 = [ 'id' => 1, 'name' => '100% cuisse, 100% qualité', 'url' => '/assets/images/sans-label.jpg', - ); - $tabPlusProduit3 = array( + ]; + $tabPlusProduit3 = [ 'id' => 2, 'name' => 'Une recette sans colorant, sans exhausteur de goût et sans conservateur', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $product = new Product(); $product->gamme_id = $gamme->id; $product->name = 'Steak haché de poulet'; @@ -321,10 +321,10 @@ class GammesSeeder extends Seeder $product->pictos = json_encode(['poele' => $tabPoele]); $product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]); $product->is_published = true; - $product->is_on_top = rand(true, false); - $product->is_news = rand(true, false); - $product->is_food_service = rand(true, false); - $product->is_halal = rand(true, false); + $product->is_on_top = random_int(true, false); + $product->is_news = random_int(true, false); + $product->is_food_service = random_int(true, false); + $product->is_halal = random_int(true, false); $product->seo_title = 'recette, qualité, viande, cuisse, steak haché, poulet'; $product->seo_description = 'Doux vous propose un Steak haché de poulet préparé en France'; $product->save(); @@ -345,11 +345,11 @@ class GammesSeeder extends Seeder $gamme->alt_text_banner = $gamme->title; $gamme->save(); - $tabPlusProduit1 = array( + $tabPlusProduit1 = [ 'id' => 0, 'name' => 'Volailles nourries exclusivement avec des végétaux, des minéraux et des vitamines', 'url' => '/assets/images/sans-label.jpg', - ); + ]; $product = new Product(); $product->gamme_id = $gamme->id; $product->name = 'Poulet sans abats'; @@ -363,10 +363,10 @@ class GammesSeeder extends Seeder $product->pictos = ''; $product->plusproduit = json_encode([$tabPlusProduit1]); $product->is_published = true; - $product->is_on_top = rand(true, false); - $product->is_news = rand(true, false); - $product->is_food_service = rand(true, false); - $product->is_halal = rand(true, false); + $product->is_on_top = random_int(true, false); + $product->is_news = random_int(true, false); + $product->is_food_service = random_int(true, false); + $product->is_halal = random_int(true, false); $product->seo_title = 'volaille, poulet, Doux, qualités'; $product->seo_description = 'Doux vous propose des Poulets entiers congelés, nés, élevés et préparés en France'; $product->save(); diff --git a/database/seeders/PictosSeeder.php b/database/seeders/PictosSeeder.php index 80c89d5..64519d9 100644 --- a/database/seeders/PictosSeeder.php +++ b/database/seeders/PictosSeeder.php @@ -26,7 +26,7 @@ class PictosSeeder extends Seeder $picto = new Picto(); $imgpath = Utils::storeImage($upload, $picto->getTable()); - foreach ($tabEncarts as $key => $value) { + foreach ($tabEncarts as $value) { for ($i = 0; $i < 5; $i++) { $picto = new Picto(); $picto->page = $value; diff --git a/database/seeders/SlidersSeeder.php b/database/seeders/SlidersSeeder.php index f69627d..7593460 100644 --- a/database/seeders/SlidersSeeder.php +++ b/database/seeders/SlidersSeeder.php @@ -16,11 +16,11 @@ class SlidersSeeder extends Seeder public function run() { Slider::factory(1)->create() - ->each(function (Slider $slider) { + ->each(function (Slider $slider): void { $i = 0; Slide::factory(3)->make() - ->each(function (Slide $slide) use ($slider, &$i) { + ->each(function (Slide $slide) use ($slider, &$i): void { $slide->order = $i++; $slide->slider()->associate($slider); $slide->save(); diff --git a/database/seeders/TextsSeeder.php b/database/seeders/TextsSeeder.php index 34fbec3..f32edcb 100644 --- a/database/seeders/TextsSeeder.php +++ b/database/seeders/TextsSeeder.php @@ -21,7 +21,7 @@ class TextsSeeder extends Seeder $i = 0; Text::factory(3)->make() - ->each(function (Text $encart) use ($tabEncarts, &$i) { + ->each(function (Text $encart) use ($tabEncarts, &$i): void { $encart->page = $tabEncarts[$i]->value; $encart->save(); }); diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..609bfd9 --- /dev/null +++ b/rector.php @@ -0,0 +1,57 @@ +withAutoloadPaths([ + __DIR__ . '/app', + __DIR__ . '/vendor/laravel/framework/src', + ]) + ->withPaths([ + __DIR__ . '/app', + __DIR__ . '/bootstrap', + __DIR__ . '/config', + __DIR__ . '/database', + __DIR__ . '/routes', + ]) + ->withPhpSets(php85: true) + ->withComposerBased(laravel: true) + ->withSets([ + LaravelLevelSetList::UP_TO_LARAVEL_130, + LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL, + LaravelSetList::LARAVEL_CODE_QUALITY, + LaravelSetList::LARAVEL_COLLECTION, + LaravelSetList::LARAVEL_IF_HELPERS, + LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES, + LaravelSetList::LARAVEL_TYPE_DECLARATIONS, + ]) + ->withTypeCoverageLevel(0) + ->withDeadCodeLevel(0) + ->withCodeQualityLevel(0) + ->withSkip([ + // Disable Laravel notations. + CommandHiddenPropertyToHiddenAttributeRector::class, + DescriptionPropertyToDescriptionAttributeRector::class, + FillablePropertyToFillableAttributeRector::class, + HiddenPropertyToHiddenAttributeRector::class, + ModelCastsPropertyToCastsMethodRector::class, + SignaturePropertyToSignatureAttributeRector::class, + TablePropertyToTableAttributeRector::class, + WithoutTimestampsPropertyToWithoutTimestampsAttributeRector::class, + + // Validation. + ValidationRuleArrayStringValueToArrayRector::class, + ]); diff --git a/routes/console.php b/routes/console.php index e216465..7136a2f 100644 --- a/routes/console.php +++ b/routes/console.php @@ -14,6 +14,6 @@ use Illuminate\Support\Facades\Artisan; | */ -Artisan::command('inspire', function () { +Artisan::command('inspire', function (): void { $this->comment(Inspiring::quote()); })->purpose('Display an inspiring quote'); diff --git a/routes/web.php b/routes/web.php index f3ea148..aa1d920 100644 --- a/routes/web.php +++ b/routes/web.php @@ -54,7 +54,7 @@ Route::prefix('bo') ->name('bo.') ->middleware(['admin-secure']) ->group( - function () { + function (): void { Auth::routes( [ 'login' => true, @@ -70,7 +70,7 @@ Route::prefix('bo') ); Route::middleware(['auth:web', 'back-end-globals']) ->group( - function () { + function (): void { Route::get( '/', [ @@ -122,7 +122,7 @@ if (!app()->runningInConsole()) { ->prefix($lang) ->name($lang == '' ? '' : $lang . '.') ->group( - function () use ($lang) { + function () use ($lang): void { Route::get('/', [ControllersHomeController::class, 'index'])->name('home'); Route::get(