core/scripts/dev/commit-code-check.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index edd089bbd5..f3e6d533f2 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -242,11 +242,15 @@ if [[ $PHPSTAN_DIST_FILE_CHANGED == "1" ]] || [[ "$DRUPALCI" == "1" ]] || [[ "$IS_DRUPAL_CORE" == "0" ]]; then printf "\nRunning PHPStan on *all* files.\n" PHPSTAN_CONFIGURATION="$DRUPAL_ROOT/core/phpstan.neon.dist" + PHPSTAN_ROOT="$DRUPAL_ROOT/core" # Detect the presence of a phpstan.neon.dist in the current project, or fall back to Drupal core's. if [[ "$IS_DRUPAL_CORE" == "0" ]] && [[ -f "$TOP_LEVEL/phpstan.neon.dist" ]]; then PHPSTAN_CONFIGURATION="$TOP_LEVEL/phpstan.neon.dist" fi - php -d apc.enabled=0 -d apc.enable_cli=0 $DRUPAL_ROOT/vendor/bin/phpstan analyze --no-progress --configuration="$PHPSTAN_CONFIGURATION" $TOP_LEVEL + if [[ "$IS_DRUPAL_CORE" == "0" ]]; then + PHPSTAN_ROOT="$TOP_LEVEL" + fi + php -d apc.enabled=0 -d apc.enable_cli=0 $DRUPAL_ROOT/vendor/bin/phpstan analyze --no-progress --configuration="$PHPSTAN_CONFIGURATION" $PHPSTAN_ROOT else # Only run PHPStan on changed files locally. printf "\nRunning PHPStan on changed files.\n"