From 095b0d967dbbf9dccb8c4eb96db8f325aced4e70 Mon Sep 17 00:00:00 2001 From: Younes ENNAJI Date: Sun, 20 Oct 2024 15:00:48 +0100 Subject: [PATCH 1/3] chore: add Laravel excluded paths option --- src/Laravel/FlasherServiceProvider.php | 5 ++++- src/Laravel/Phpstan/stubs/Repository.stub | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Laravel/FlasherServiceProvider.php b/src/Laravel/FlasherServiceProvider.php index e55dc732..3e23a54a 100644 --- a/src/Laravel/FlasherServiceProvider.php +++ b/src/Laravel/FlasherServiceProvider.php @@ -227,10 +227,13 @@ final class FlasherServiceProvider extends PluginServiceProvider } $this->app->singleton(FlasherMiddleware::class, static function (Application $app) { + $config = $app->make('config'); + $flasher = $app->make('flasher'); $cspHandler = $app->make('flasher.csp_handler'); + $excludedPaths = $config->get('flasher.excluded_paths', []) ?: []; - return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler)); + return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler, $excludedPaths)); }); $this->pushMiddlewareToGroup(FlasherMiddleware::class); diff --git a/src/Laravel/Phpstan/stubs/Repository.stub b/src/Laravel/Phpstan/stubs/Repository.stub index 72c24482..4bc2dd80 100644 --- a/src/Laravel/Phpstan/stubs/Repository.stub +++ b/src/Laravel/Phpstan/stubs/Repository.stub @@ -13,6 +13,7 @@ namespace Illuminate\Contracts\Config; * scripts: string[], * styles: string[], * options: array, + * excluded_paths?: list, * filter: array, * flash_bag: array, * presets: array, @@ -44,6 +45,7 @@ interface Repository * ($key is 'flasher.presets' ? array : * ($key is 'flasher.plugins' ? array : * ($key is 'flasher.flash_bag' ? array : + * ($key is 'flasher.excluded_paths' ? list : * mixed))))))) */ public function get(string|array $key, mixed $default = null): mixed; From 1da13926706e48a60f106cbbbdea80a9cce5056c Mon Sep 17 00:00:00 2001 From: Younes ENNAJI Date: Sun, 20 Oct 2024 15:03:15 +0100 Subject: [PATCH 2/3] chore: update CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a59846e..41f22399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG for 2.x -## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.0...2.x) +## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.1...2.x) + +## [v2.1.1](https://github.com/php-flasher/php-flasher/compare/v2.1.0...v2.1.1) - 2024-10-20 + +* feature [Laravel] Add `excluded_paths` option. See [PR #203](https://github.com/php-flasher/php-flasher/pull/203) by [yoeunes](https://github.com/yoeunes) ## [v2.1.0](https://github.com/php-flasher/php-flasher/compare/v2.0.4...v2.1.0) - 2024-10-19 From cf3943bc08842cd098ad3f7d4f4d440b66f44e4a Mon Sep 17 00:00:00 2001 From: Younes ENNAJI Date: Sun, 20 Oct 2024 15:05:07 +0100 Subject: [PATCH 3/3] fix: phpstan return type --- package-lock.json | 2 +- src/Laravel/Phpstan/stubs/Repository.stub | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 24040d9f..31aca6f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1967,7 +1967,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/src/Laravel/Phpstan/stubs/Repository.stub b/src/Laravel/Phpstan/stubs/Repository.stub index 4bc2dd80..43d7eb7c 100644 --- a/src/Laravel/Phpstan/stubs/Repository.stub +++ b/src/Laravel/Phpstan/stubs/Repository.stub @@ -46,7 +46,7 @@ interface Repository * ($key is 'flasher.plugins' ? array : * ($key is 'flasher.flash_bag' ? array : * ($key is 'flasher.excluded_paths' ? list : - * mixed))))))) + * mixed)))))))) */ public function get(string|array $key, mixed $default = null): mixed; }