diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0badf81..e153a5d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -41,6 +41,7 @@ jobs: php-version: "${{ matrix.php-version }}" extensions: "${{ env.PHP_EXTENSIONS }}" coverage: "none" + tools: "symfony" - name: "Install composer dependencies" uses: "ramsey/composer-install@v3" @@ -65,6 +66,9 @@ jobs: - name: "Lint twig files" run: "(cd tests/Application && bin/console lint:twig ../../src/Resources)" + - name: "Symfony diagnostics" + run: "symfony lsp:check --format=github" + dependency-analysis: name: "Dependency Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})" diff --git a/.gitignore b/.gitignore index 4899dfc..dfcf9ef 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ /.phpunit.cache/ /.phpunit.result.cache +# symfony lsp:check analyzes the repository root and caches in var/symfony-lsp +/var/ + # Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project /.php-version /php.ini diff --git a/.symfony-lsp.json b/.symfony-lsp.json new file mode 100644 index 0000000..1b2add6 --- /dev/null +++ b/.symfony-lsp.json @@ -0,0 +1,8 @@ +{ + "version": 1, + "projectRoots": [ + "." + ], + "kernel": "Acme\\SyliusExamplePlugin\\Tests\\Application\\Kernel", + "translationDiagnostics": true +} diff --git a/CLAUDE.md b/CLAUDE.md index 156be9f..9d251f0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,6 +41,7 @@ Based on the `composer.json` scripts section: - `composer check-style` - Check code style with ECS (Easy Coding Standard) - `composer fix-style` - Fix code style issues automatically with ECS - `composer phpunit` - Run PHPUnit tests +- `symfony lsp:check` - Run Symfony-aware diagnostics (routes, services, templates, translations, config) against the plugin and its test application. Requires the Symfony CLI 5.20 or newer ### Static Analysis diff --git a/tests/Application/config/packages/framework.yaml b/tests/Application/config/packages/framework.yaml index 3df2c0a..753cd81 100644 --- a/tests/Application/config/packages/framework.yaml +++ b/tests/Application/config/packages/framework.yaml @@ -1,9 +1,14 @@ +parameters: + # Adds a fallback APP_SECRET if the env var is not set, like DATABASE_URL in doctrine.yaml. symfony lsp:check + # analyzes the repository root and only loads a .env file from there, so it boots the kernel without + # tests/Application/.env + env(APP_SECRET): 'EDITME' + framework: secret: '%env(APP_SECRET)%' ide: phpstorm form: enabled: true - legacy_error_messages: false csrf_protection: true session: handler_id: ~ diff --git a/tests/Application/config/packages/security.yaml b/tests/Application/config/packages/security.yaml index 2f5c687..a070ffb 100644 --- a/tests/Application/config/packages/security.yaml +++ b/tests/Application/config/packages/security.yaml @@ -1,5 +1,4 @@ security: - enable_authenticator_manager: true providers: sylius_admin_user_provider: id: sylius.admin_user_provider.email_or_name_based