Skip to content

Upgrade Twig CS Fixer to v4 and preserve operator spacing checks - #38

Merged
spantaleev merged 1 commit into
masterfrom
artidezi/tsk_01m5p54wd7e9y55qmcax48tzhv
Oct 24, 2026
Merged

spantaleev merged 1 commit into
masterfrom
artidezi/tsk_01m5p54wd7e9y55qmcax48tzhv

Conversation

@artidezi-etke-cc

Copy link
Copy Markdown
Contributor

Adapts #31 at 23912b3aba0731e2d08fe80ddb005344b3262440.

Prepared a replacement commit containing the Twig CS Fixer 4.1.1 update and its lockfile, plus the two new operator spacing rules required to preserve existing lint coverage. The unadapted PR silently accepts malformed ternary and unary spacing. All requested local dependency, PHP and frontend checks passed; no application runtime, image, browser asset or workflow changes were needed. Human merge is required.

Agent-assessed risk: Low. This development-tool update preserves the existing spacing policy, with a focused regression check and passing application checks; production dependencies and runtime code are unchanged.

Evidence (8 items)
  • Evidence: git diff ee5e8d0f5b218418a745c507e89c4219f601a0d5...refs/artidezi/inputs/source-pr — Merge base equals the recorded target base. The source changes only app/composer.json and app/composer.lock, upgrading vincentlanglet/twig-cs-fixer from 3.14.0 to 4.1.1; no target-only changes require reconciliation.
  • Documentation: source — The v4 migration guide splits OperatorSpacingRule into operator, ternary and unary rules. The changed DelimiterSpacingRule constructor remains compatible with the repository’s no-argument invocation. Added TernaryOperatorSpacingRule and UnaryOperatorSpacingRule to the existing custom ruleset.
  • Local check: ./bin/composer install --no-interaction --prefer-dist; ./bin/composer validate --strict; ./bin/composer audit --locked — All passed using the repository helper. Composer manifest is valid and no security advisories were found. Locked Twig 3.28.0 satisfies the fixer’s new ^3.15 requirement; its Symfony constraints support the existing 8.1 components.
  • Local check: docker build --iidfile /tmp/artidezi-php-image.id etc/docker/php; docker run --rm --network none --user "$(id -u):$(id -g)" --mount "type=bind,src=$PWD,dst=/code" --workdir /code/app --entrypoint /bin/sh "$(cat /tmp/artidezi-php-image.id)" -ec 'vendor/bin/phpstan analyse -c phpstan.neon && vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php && vendor/bin/twig-cs-fixer lint --config=.twig-cs-fixer.dist.php' — Build succeeded using cached layers. All checks passed: PHPStan analysed 145 files, PHP CS Fixer checked 146 files, and Twig lint checked 38 templates with no errors. Runtime probe reported PHP 8.5.12 and MongoDB driver 2.5.5, satisfying locked mongodb/mongodb 2.5.0’s ^2.5 driver requirement. PHP CS Fixer emitted an informational warning that the runtime is newer than composer.json’s PHP 8.4 minimum. No live database or monitoring stack was started.
  • Local check: vendor/bin/twig-cs-fixer lint --no-cache --config=<original-or-adapted-config> <isolated-fixture>; vendor/bin/twig-cs-fixer fix --no-cache --config=<adapted-config> <isolated-fixture> — Executed in the built PHP image with isolated temporary fixtures containing {{ enabled?1:0 }} and {{ not enabled }}. The original PR ruleset passed incorrectly; the adapted ruleset reported five spacing errors. Fixing and subsequent lint passed. Temporary fixtures were removed and were not committed.
  • Local check: just js-analyze js-build; ./bin/node /bin/sh -c 'cd /app/src && npm audit' — ESLint, TypeScript checking, frontend image/asset build and npm audit all passed; npm reported zero vulnerabilities. Ignored generated assets were not committed. Browser behavior was not exercised because the update changes only a PHP development tool and lint configuration.
  • Local check: git diff --check; git status --porcelain=v1 — Whitespace validation passed before committing. Final working tree is clean. Replacement commit includes all original PR changes and the compatibility fix; no workflow files changed.
  • Evidence: Provided source CI snapshot for 23912b3aba0731e2d08fe80ddb005344b3262440 — The supplied snapshot reports successful frontend and php checks for the original source head. This is supporting point-in-time evidence, not a fresh controller gate for the replacement commit.

Human review and merge are required.

@spantaleev
spantaleev merged commit 1c3fda4 into master Oct 24, 2026
2 checks passed
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