Repository navigation
Fix #164. Symlink PHPStan configuration from the project root - #187
Open
claudiu-cristea wants to merge 1 commit into
Open
claudiu-cristea wants to merge 1 commit into
claudiu-cristea wants to merge 1 commit into
Conversation
The phpstan command linked $DDEV_DOCROOT/phpstan.neon into the extension directory, but $DDEV_DOCROOT is relative, so the link never resolved and PHPStan ran without any configuration. Link to the project root with absolute targets, and replace stale links, never real files. Co-Authored-By: Claude Opus 5.5 <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.
The Issue
ddev phpstansymlinks$DDEV_DOCROOT/phpstan.neoninto the extension directory.$DDEV_DOCROOTis relative (web), so the link resolves toweb/modules/custom/<project>/web/phpstan.neon, which doesn't exist. PHPStan then runs with no configuration, skippingignoreErrorsand the baseline, and its results differ from the GitLab CIphpstanjob.Also,
ln -s … || truenever replaces an existing link, so a broken link stays broken.How This PR Solves The Issue
The command starts in the project root, where it creates
phpstan.neon, so it now records that directory before changing into the extension directory. It then links both files with absolute targets, usingln -sfnso stale links get replaced. A real file in the extension directory is never overwritten.Manual Testing Instructions
ddev phpstannow printsNote: Using configuration file …/phpstan.neon, andreadlink web/modules/custom/<project>/phpstan.neonreturns/var/www/html/phpstan.neon. The same holds when an old broken link is already present.Automated Testing Overview
New test in
tests/full.bats, "phpstan uses the project root configuration". It recreates the broken relative link from earlier versions, runsddev phpstan, and asserts that PHPStan uses a configuration file and that both links point to the project root.Release/Deployment Notes
None. Existing broken links are repaired the next time
ddev phpstanruns.🤖 Generated with Claude Code