Preliminary checklist
Expected Behavior
"ddev phpstan" respects the phpstan.neon and phpstan-baseline.neon at my project root.
(e.g. "ignoreErrors" setting is respected)
Actual Behavior
"ddev phpstan" ignores phpstan.neon and phpstan-baseline.neon at my project root.
(e.g. "ignoreErrors" setting is not respected)
Symlinks to phpstan.neon are like this:
Steps To Reproduce
- Create a (Drupal) project with some php files that would cause phpstan errors.
- Install and start ddev-drupal-contrib following the usual instructions.
- In
config.yml there will be docroot: web.
- Create a phpstan.neon at project root, with
ignoreErrors to ignore some of those errors.
- Run
ls -lA web/modules/custom/<project name>/ | grep phpstan
- The
phpstan.neon is not found.
- Run
ddev symlink-project.
- We find `phpstan.neon -> /var/www/html/phpstan.neon
- Remove
web/modules/custom/<project name>/phpstan.neon.
- Run
ddev phpstan.
- The settings in
phpstan.neon are ignored.
- Run
ls -lA web/modules/custom/<project name>/ | grep phpstan as before.
- We find
phpstan.neon -> web/phpstan.neon.
Anything else?
The problem seems to be coming from this commit:
733be88#r176975897
EXTENSION_DIRECTORY=$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}
cd "$EXTENSION_DIRECTORY" || exit 1
# Ensure PHPStan configuration is symlinked from project root.
ln -s $DDEV_DOCROOT/phpstan.neon 2>/dev/null || true
ln -s $DDEV_DOCROOT/phpstan-baseline.neon 2>/dev/null || true
phpstan analyze . "$@"
For me, $DDEV_DOCROOT is just "web".
But this can never lead to a correct result.
The phpstan.neon is not in web root but in project root, and the path "web" would only work relative to project root, not relative to $EXTENSION_DIRECTORY.
Preliminary checklist
Expected Behavior
"ddev phpstan" respects the
phpstan.neonandphpstan-baseline.neonat my project root.(e.g. "ignoreErrors" setting is respected)
Actual Behavior
"ddev phpstan" ignores
phpstan.neonandphpstan-baseline.neonat my project root.(e.g. "ignoreErrors" setting is not respected)
Symlinks to
phpstan.neonare like this:Steps To Reproduce
config.ymlthere will bedocroot: web.ignoreErrorsto ignore some of those errors.ls -lA web/modules/custom/<project name>/ | grep phpstanphpstan.neonis not found.ddev symlink-project.web/modules/custom/<project name>/phpstan.neon.ddev phpstan.phpstan.neonare ignored.ls -lA web/modules/custom/<project name>/ | grep phpstanas before.phpstan.neon -> web/phpstan.neon.Anything else?
The problem seems to be coming from this commit:
733be88#r176975897
For me,
$DDEV_DOCROOTis just "web".But this can never lead to a correct result.
The
phpstan.neonis not in web root but in project root, and the path "web" would only work relative to project root, not relative to$EXTENSION_DIRECTORY.