From a3900b03e80ad647412f34ff444b12d4d87f2cfd Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Sun, 5 Jan 2025 14:26:31 +0100 Subject: [PATCH] check php syntax on all supported PHP versions --- .github/workflows/check-php-syntax.yml | 23 +++++++++++++++++++++++ composer.json | 1 + 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/check-php-syntax.yml diff --git a/.github/workflows/check-php-syntax.yml b/.github/workflows/check-php-syntax.yml new file mode 100644 index 00000000..4520172e --- /dev/null +++ b/.github/workflows/check-php-syntax.yml @@ -0,0 +1,23 @@ +name: Check PHP syntax + +on: [ push, pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + steps: + # Install PHP interpreter + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + # Checkout source repository + - name: checkout repo + uses: actions/checkout@v3 + + # Lint every PHP source file using PHP interpreter + - run: composer run check-syntax diff --git a/composer.json b/composer.json index d9831155..15b00267 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ }, "scripts": { "test": "php vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/", + "check-syntax": "find . -name '*.php' -not -path './vendor/*' -not -path './var/cache/*' -print0 | xargs -0 -n1 php -l", "lint": "vendor/bin/phpcs -n -s", "fmt": "vendor/bin/phpcbf" }