Skip to content

Commit 733be88

Browse files
authored
Fix PHPStan baseline generation (#114)
* Fix PHPStan baseline generation Closes #92 * Leverage DDEV_SITENAME for contrib name detection
1 parent 19b8152 commit 733be88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

commands/web/phpstan

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ test -e phpstan.neon || curl -OL https://git.drupalcode.org/project/gitlab_templ
1818
sed -i 's/BASELINE_PLACEHOLDER/phpstan-baseline.neon/g' phpstan.neon
1919
# Add an empty baseline file to ensure it exists.
2020
test -e phpstan-baseline.neon || touch phpstan-baseline.neon
21-
phpstan analyse $DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH "$@"
21+
22+
EXTENSION_DIRECTORY=$DDEV_DOCROOT/$DRUPAL_PROJECTS_PATH/${DDEV_SITENAME//-/_}
23+
cd "$EXTENSION_DIRECTORY" || exit 1
24+
# Ensure PHPStan configuration is symlinked from project root.
25+
ln -s $DDEV_DOCROOT/phpstan.neon 2>/dev/null || true
26+
ln -s $DDEV_DOCROOT/phpstan-baseline.neon 2>/dev/null || true
27+
phpstan analyze . "$@"

0 commit comments

Comments
 (0)