Remove dev-only DomCrawler from production /impress, /privacy, /grenzwerte path (#536)#549
Open
maltehuebner wants to merge 1 commit into
Open
Remove dev-only DomCrawler from production /impress, /privacy, /grenzwerte path (#536)#549maltehuebner wants to merge 1 commit into
maltehuebner wants to merge 1 commit into
Conversation
…r path TemplateController::staticAction (routes /privacy, /impress, /grenzwerte) extracted the page title by rendering the template a second time and parsing its <h2> with Symfony\Component\DomCrawler\Crawler + ->filter() (css-selector). Both symfony/dom-crawler and symfony/css-selector are only require-dev dependencies (pulled via symfony/browser-kit), so a production build with `composer install --no-dev` fatals with "Class Symfony\Component\DomCrawler\Crawler not found" on those routes. Replace the H2 parsing with an explicit `title` route default (Datenschutzerklärung / Impressum / Übersicht über Schadstoffe und Grenzwerte), matching the previous H2 text. This also removes: - the double full render of every static template per request, - the EntrypointLookup reset workaround (and the now-unused EntrypointLookupCollectionInterface constructor dependency), - the always-true ternary (`$h2 ? $h2->text() : null`) and its phpstan-baseline entry. dom-crawler/css-selector stay dev-only (still used by browser-kit in tests); no production code references them anymore. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TemplateController::staticAction(routes/privacy,/impress,/grenzwerte) derived the page title by rendering the template a second time and parsing its<h2>withSymfony\Component\DomCrawler\Crawler+->filter()(which additionally needssymfony/css-selector). Bothsymfony/dom-crawlerandsymfony/css-selectorarerequire-dev-only (pulled transitively viasymfony/browser-kit), so a production build withcomposer install --no-devfatals withClass Symfony\Component\DomCrawler\Crawler not foundon all three routes.Changes
titleroute default inconfig/routing/1_static.yaml(Datenschutzerklärung/Impressum/Übersicht über Schadstoffe und Grenzwerte), matching the exact previous H2 text.staticActionnow takes astring $titleargument bound from the route default.readH2Tag()and with it:EntrypointLookupreset workaround and the now-unusedEntrypointLookupCollectionInterfaceconstructor dependency (the constructor is gone;ManagerRegistrycomes from the parent),$h2 ? $h2->text() : nulland itsphpstan-baseline.neonentry.DomCrawler/CssSelectoranymore; they remain dev-only (still used bybrowser-kitin the Integration test suite).Deliberately not implemented
--no-devsmoke-build CI job (optional item): worth adding as a guard, but left as a follow-up to avoid coupling this focused fix to CI-pipeline changes.Verification
grepconfirms noDomCrawler/CssSelector/Crawler/EntrypointLookupCollectionreferences remain insrc/.vendor/bin/phpstan analyse— No errors (baseline entry removed).vendor/bin/phpunit --testsuite="Project Test Suite"— 121 tests green.bin/console lint:container --env=prod— OK.bin/console debug:router privacy --env=prod— showstitle: Datenschutzerklärungdefault.Note: the
/impressand/privacyIntegration tests assert on the template's own<h2>(not the SEO title), so behaviour is unchanged; they run in the DB/network-dependent Integration suite, not exercised here.Closes #536
🤖 Generated with Claude Code