Skip to content

Add Symfony LSP diagnostics to CI - #87

Open
loevgaard wants to merge 3 commits into
1.14.xfrom
symfony-lsp-check-1.14.x
Open

Add Symfony LSP diagnostics to CI#87
loevgaard wants to merge 3 commits into
1.14.xfrom
symfony-lsp-check-1.14.x

Conversation

@loevgaard

@loevgaard loevgaard commented Sep 9, 2026

Copy link
Copy Markdown
Member

Integrates symfony lsp:check into the build workflow as a step of the coding-standards job (PHP 8.1, highest deps), next to the YAML and Twig lint steps. It runs symfony lsp:check --format=github, so unknown routes/services/templates/translation keys, deprecated config keys etc. show up as annotations on pull requests.

Repository changes needed for symfony-lsp to find and boot the test application

symfony-lsp discovers an application only if its composer.json requires symfony/framework-bundle, locates the kernel through a PSR-4 entry in that composer.json, and boots it via <project>/vendor/autoload.php. The test application is not a standalone Composer project, hence:

  • tests/Application/composer.json now declares the symfony/framework-bundle requirement and the PSR-4 namespace of the kernel. Nothing is ever installed from this file; it is only a marker (as it already was for project-dir resolving).
  • tests/Application/vendor is a symlink to the root vendor directory.
  • phpunit.xml.dist excludes tests/Application and vendor from test discovery because PHPUnit follows symlinks (without this it would try to load the 500+ test classes shipped in vendor).
  • .symfony-lsp.json points symfony-lsp at tests/Application and enables translation diagnostics.
  • CLAUDE.md documents the command.

The second commit removes the two deprecated config keys the check flagged in the test application (framework.form.legacy_error_messages, security.enable_authenticator_manager). Both are no-ops on Symfony 6.4.

Verification (local, PHP 8.3, symfony-lsp 0.20.0)

  • symfony-lsp check: 0 diagnostics, exit code 0 (2 deprecation warnings before the second commit)
  • vendor/bin/phpunit: 3 tests OK, only the plugin's own tests are discovered
  • bin/console lint:container (test env) and lint:yaml pass
  • ECS, PHPStan and Rector are unaffected by the symlink (they do not follow symlinks)

Running the check locally requires the Symfony CLI 5.20 or newer (symfony lsp:check), or the standalone symfony-lsp binary from https://github.com/symfony/language-tools/releases.

Run `symfony lsp:check` (https://symfony.com/blog/introducing-symfony-lsp-check-symfony-aware-diagnostics-in-your-ci)
as a new "symfony-diagnostics" job so that unknown routes, services,
templates, translation keys, deprecated configuration keys etc. are
reported as GitHub annotations.

symfony-lsp only discovers a Symfony application when its composer.json
requires symfony/framework-bundle and, to boot it, needs a PSR-4 entry
pointing at the kernel plus <project>/vendor/autoload.php. The test
application is not a standalone Composer project, so:

- tests/Application/composer.json declares the framework-bundle
  requirement and the PSR-4 namespace of the kernel (nothing is ever
  installed from this file)
- tests/Application/vendor is a symlink to the root vendor directory
- phpunit.xml.dist excludes tests/Application and vendor because
  PHPUnit follows symlinks when discovering tests
- .symfony-lsp.json points symfony-lsp at tests/Application and enables
  translation diagnostics
framework.form.legacy_error_messages and
security.enable_authenticator_manager are deprecated no-ops on
Symfony 6.4.
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cae313a) to head (311b161).

Additional details and impacted files
@@             Coverage Diff             @@
##              1.14.x       #87   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity         2         2           
===========================================
  Files              2         2           
  Lines             16        16           
===========================================
  Hits              16        16           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The check belongs with the other lint steps rather than in a job of
its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant