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 9b2211b..255f6e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ USER dev COPY --chown=dev composer.json ./ -ARG LARAVEL=9 +ARG LARAVEL=10 RUN composer require laravel/framework ^$LARAVEL.0 COPY --chown=dev . . 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; + } +}