Skip to content

Pass the --symfony-version option to the build configuration - #210

Open
Amoifr wants to merge 2 commits into
symfony-tools:mainfrom
Amoifr:fix-symfony-version-option
Open

Pass the --symfony-version option to the build configuration#210
Amoifr wants to merge 2 commits into
symfony-tools:mainfrom
Amoifr:fix-symfony-version-option

Conversation

@Amoifr

@Amoifr Amoifr commented Jul 11, 2026

Copy link
Copy Markdown

Note

Built on top of #209, since both touch src/Application.php and this PR extends the test file added there. Please merge #209 first — the diff shown here will shrink accordingly.

Application::__construct() takes a $symfonyVersion… and drops it on the floor. It's never passed to BuildConfig, so --symfony-version (and SYMFONY_VERSION) have no effect: every build silently uses BuildConfig's own default of 4.4.

Easy to see:

$ php bin/docs-builder build:docs docs/ output/ --symfony-version=6.4
$ grep -o 'symfony/symfony/blob/[0-9.]*' output/*.html
symfony/symfony/blob/4.4      # ← asked for 6.4

So every :class:, :method: and :namespace: link points at the wrong branch.

The fix wires the version into BuildConfig when one is given. After it, the same command yields blob/6.4, and SYMFONY_VERSION=7.4 yields blob/7.4.

On the default. The binary used to fall back to 'master' — a branch that doesn't exist on symfony/symfony anymore, and which would have produced 404 links the moment the value was actually honored. Rather than resurrect it, the fallback is now "no version given", which leaves BuildConfig's default (4.4) in place: builds that pass no option keep behaving exactly as they do today. The option's displayed default now reads from BuildConfig too, so --help no longer advertises a value the builder doesn't use.

Happy to make the default something more current than 4.4 if you'd like — that felt like your call rather than mine, so I left it alone.

Tests cover the three paths through the binary: the option, the env var, and the default. The first two fail without the fix (the built HTML links to 4.4 instead of the requested branch).

Full suite green: 72 tests, 162 assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant