Skip to content

Commit ef6d43a

Browse files
check php syntax on all supported PHP versions
1 parent cf91374 commit ef6d43a

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check PHP syntax
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
11+
steps:
12+
# Install PHP interpreter
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: ${{ matrix.php-versions }}
17+
18+
# Checkout source repository
19+
- name: checkout repo
20+
uses: actions/checkout@v3
21+
22+
# Lint every PHP source file using PHP interpreter
23+
- run: composer run check-syntax

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
php-versions: [ '8.2', '8.3' ]
8+
php-versions: [ '8.3' ]
99
steps:
1010
- uses: actions/checkout@v3
1111
- uses: shivammathur/setup-php@v2

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"scripts": {
3030
"make-pot": "wp i18n make-pot . languages/mailchimp-for-wp.pot --exclude=assets/js",
3131
"test": "phpunit tests/",
32-
"codestyle": "phpcs -n -s"
32+
"codestyle": "phpcs -n -s",
33+
"check-syntax": "find . -name '*.php' -not -path './vendor/*' -not -path './var/cache/*' -print0 | xargs -0 -n1 php -l"
3334
},
3435
"config": {
3536
"allow-plugins": {

0 commit comments

Comments
 (0)