Skip to content

Commit 241adc0

Browse files
committed
fix(ci): use PHP 8.2 for code quality checks
The wordpress-stubs v6.8+ package contains PHP 8+ syntax in stub files, which causes parse errors when PHPStan runs on PHP 7.4. PHPStan can analyze PHP 7.4-compatible code while running on PHP 8.x, so this change updates the CI workflow to use PHP 8.2 for all code quality checks.
1 parent eb6eb33 commit 241adc0

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

.github/workflows/code-quality.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,11 @@ jobs:
6565
id: detect-php-version
6666
run: |
6767
PLUGIN="${{ steps.plugin.outputs.slug }}"
68-
PHP_VERSION="7.4"
69-
if [ -f "plugins/$PLUGIN/composer.json" ]; then
70-
DETECTED_VERSION=$(jq -r '.require["php"] // empty' plugins/$PLUGIN/composer.json | grep -oE '[0-9]+\.[0-9]+' | head -1)
71-
if [ -n "$DETECTED_VERSION" ]; then
72-
PHP_VERSION="$DETECTED_VERSION"
73-
echo "Detected PHP version $PHP_VERSION from composer.json"
74-
else
75-
echo "No PHP version found in composer.json, using default $PHP_VERSION"
76-
fi
77-
else
78-
echo "No composer.json found, using default PHP version $PHP_VERSION"
79-
fi
68+
# Use PHP 8.2 for code quality checks - PHPStan/Psalm can analyze older PHP code
69+
# while running on newer PHP. This is required because wordpress-stubs v6.8+
70+
# contain PHP 8+ syntax that cannot be parsed by PHP 7.4.
71+
PHP_VERSION="8.2"
72+
echo "Using PHP $PHP_VERSION for code quality checks"
8073
echo "php-version=$PHP_VERSION" >> $GITHUB_OUTPUT
8174
quality-checks:
8275
needs: detect-plugins

0 commit comments

Comments
 (0)