From a8b4b749a0501e8d02ec5e31bc12012a37a075bc Mon Sep 17 00:00:00 2001 From: John Dent Date: Sat, 29 Nov 2025 12:48:22 +0000 Subject: [PATCH 1/3] PHPStan Extension --- composer.json | 5 ++++ extension.neon | 5 ++++ src/PHPStan/MagicEnumConstantExtension.php | 29 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 extension.neon create mode 100644 src/PHPStan/MagicEnumConstantExtension.php diff --git a/composer.json b/composer.json index 350cb24..e303622 100644 --- a/composer.json +++ b/composer.json @@ -49,6 +49,11 @@ "providers": [ "SynergiTech\\MagicEnums\\MagicEnumsServiceProvider" ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "scripts": { diff --git a/extension.neon b/extension.neon new file mode 100644 index 0000000..a5bf31f --- /dev/null +++ b/extension.neon @@ -0,0 +1,5 @@ +services: + - + class: SynergiTech\MagicEnums\PHPStan\MagicEnumConstantExtension + tags: + - phpstan.constants.alwaysUsedClassConstantsExtension diff --git a/src/PHPStan/MagicEnumConstantExtension.php b/src/PHPStan/MagicEnumConstantExtension.php new file mode 100644 index 0000000..0e41fb9 --- /dev/null +++ b/src/PHPStan/MagicEnumConstantExtension.php @@ -0,0 +1,29 @@ +getAttributes(); + + foreach ($attributes as $attribute) { + $attributeClass = $attribute->getName(); + if ( + $attributeClass === AppendConstToMagic::class || + $attributeClass === AppendValueToMagic::class + ) { + return true; + } + } + + return false; + } +} From 8b6e9f6d33cf7ead91f5ef07f0928fc048c497ca Mon Sep 17 00:00:00 2001 From: John Dent Date: Sat, 29 Nov 2025 13:44:50 +0000 Subject: [PATCH 2/3] composer config for L9 --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 9b2211b..16f0372 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ USER dev COPY --chown=dev composer.json ./ ARG LARAVEL=9 +# Currently Laravel 9 requires audit.block-insecure to be false +RUN if [ $LARAVEL = 9 ]; then composer config audit.block-insecure false; fi RUN composer require laravel/framework ^$LARAVEL.0 COPY --chown=dev . . From 436df20a6225ad8ed5bd6c9dbf22f52138d202a4 Mon Sep 17 00:00:00 2001 From: John Dent Date: Sat, 29 Nov 2025 13:55:16 +0000 Subject: [PATCH 3/3] Bye L9 --- .github/workflows/php-test.yaml | 2 +- Dockerfile | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php-test.yaml b/.github/workflows/php-test.yaml index eaa8b78..834796d 100644 --- a/.github/workflows/php-test.yaml +++ b/.github/workflows/php-test.yaml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - laravel: [9, 10, 11, 12] + laravel: [10, 11, 12] php: [8.2, 8.3, 8.4] steps: diff --git a/Dockerfile b/Dockerfile index 16f0372..255f6e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,7 @@ USER dev COPY --chown=dev composer.json ./ -ARG LARAVEL=9 -# Currently Laravel 9 requires audit.block-insecure to be false -RUN if [ $LARAVEL = 9 ]; then composer config audit.block-insecure false; fi +ARG LARAVEL=10 RUN composer require laravel/framework ^$LARAVEL.0 COPY --chown=dev . .