Skip to content

Commit 662af53

Browse files
chore: add phpstan level 0 and run in GitHub CI
1 parent 7282b68 commit 662af53

6 files changed

Lines changed: 58 additions & 48 deletions

File tree

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
name: Check PHP syntax
1+
name: Check PHP syntax on lowest supported PHP version
22

33
on: [ push, pull_request ]
44

55
jobs:
66
build:
77
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', 'highest']
118
steps:
129
- name: Setup PHP
1310
uses: shivammathur/setup-php@v2
1411
with:
15-
php-version: ${{ matrix.php-versions }}
12+
php-version: '7.4'
1613
tools: composer
1714
ini-file: development
1815

19-
- name: checkout repo
20-
uses: actions/checkout@v3
21-
16+
- uses: actions/checkout@v6
2217
- run: composer run check-syntax

.github/workflows/php-run-tests.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,16 @@ on: [ push, pull_request ]
55
jobs:
66
build:
77
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
php-versions: ['8.3']
118
steps:
129
- name: Setup PHP
1310
uses: shivammathur/setup-php@v2
1411
with:
15-
php-version: ${{ matrix.php-versions }}
12+
php-version: 'highest'
1613
tools: composer
1714

18-
- name: checkout repo
19-
uses: actions/checkout@v3
15+
- uses: actions/checkout@v6
2016
- run: composer install --no-progress
21-
22-
- name: PHPCodeSniffer
23-
run: ./vendor/bin/phpcs -ns
24-
25-
- name: PHPUnit
26-
run: ./vendor/bin/phpunit
17+
- run: composer run check-syntax
18+
- run: composer run check-codestyle
19+
- run: composer run static-analysis
20+
- run: composer run test

composer.json

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
11
{
2-
"name": "ibericode/boxzilla-wp",
3-
"description": "The best non-obtrusive call-to-actions: Boxzilla. A WordPress plugin.",
4-
"keywords": ["wordpress", "scroll triggered", "call to action"],
5-
"homepage": "https://wordpress.org/plugins/boxzilla/",
6-
"license": "GPL-2.0+",
7-
"authors": [
8-
{
9-
"name": "Danny van Kooten",
10-
"email": "hi@dannyvankooten.com",
11-
"homepage": "https://dannyvankooten.com"
12-
}
13-
],
14-
"support": {
15-
"issues": "https://github.com/ibericode/boxzilla-wp/issues",
16-
"forum": "https://wordpress.org/support/plugin/boxzilla",
17-
"source": "https://github.com/ibericode/boxzilla-wp"
18-
},
19-
"type": "wordpress-plugin",
20-
"require": {
21-
"php": ">=7.4"
22-
},
23-
"require-dev": {
24-
"phpunit/phpunit": "^10.5.40",
25-
"squizlabs/php_codesniffer": "^3.11"
26-
},
27-
"scripts": {
28-
"check-syntax": "find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -print0 | xargs -0 -n1 php -l"
29-
}
2+
"name": "ibericode/boxzilla-wp",
3+
"description": "The best non-obtrusive call-to-actions: Boxzilla. A WordPress plugin.",
4+
"keywords": [
5+
"wordpress",
6+
"scroll triggered",
7+
"call to action"
8+
],
9+
"homepage": "https://wordpress.org/plugins/boxzilla/",
10+
"license": "GPL-2.0+",
11+
"authors": [
12+
{
13+
"name": "Danny van Kooten",
14+
"email": "hi@dannyvankooten.com",
15+
"homepage": "https://dannyvankooten.com"
16+
}
17+
],
18+
"support": {
19+
"issues": "https://github.com/ibericode/boxzilla-wp/issues",
20+
"forum": "https://wordpress.org/support/plugin/boxzilla",
21+
"source": "https://github.com/ibericode/boxzilla-wp"
22+
},
23+
"type": "wordpress-plugin",
24+
"require": {
25+
"php": ">=7.4"
26+
},
27+
"require-dev": {
28+
"phpunit/phpunit": "^10.5.40",
29+
"squizlabs/php_codesniffer": "^3.11",
30+
"phpstan/phpstan": "^2.1",
31+
"szepeviktor/phpstan-wordpress": "^2.0",
32+
"phpstan/extension-installer": "^1.4"
33+
},
34+
"scripts": {
35+
"check-syntax": "find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -print0 | xargs -0 -n1 php -l",
36+
"check-codestyle": "vendor/bin/phpcs -sn",
37+
"static-analysis": "vendor/bin/phpstan analyse",
38+
"test": "vendor/bin/phpunit"
39+
},
40+
"config": {
41+
"allow-plugins": {
42+
"phpstan/extension-installer": true
43+
}
44+
}
3045
}
File renamed without changes.

phpstan.neon.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
level: 0
3+
paths:
4+
- boxzilla.php
5+
- autoload.php
6+
- src/
File renamed without changes.

0 commit comments

Comments
 (0)