Skip to content

Commit 2b160fd

Browse files
committed
Modernization in preparation for v3 stable
- Support PHP 7.4+, so we can modernize (and make it more future-proof) the codebase and the dependencies (e.g. Symfony components) - Support Composer 2.3+, so we can get rid of double logic to support v1 - Replace Psalm with PHPStan, going full on level 10 and strict rules - Improve and update GitHub Actions
1 parent b3d3e66 commit 2b160fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1971
-2213
lines changed

.github/workflows/php-cs.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: PHP Coding Standards
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/php-cs.yml'
7+
- '**.php'
8+
- '**phpcs.xml.dist'
9+
- '**composer.json'
10+
pull_request:
11+
paths:
12+
- '**workflows/php-cs.yml'
13+
- '**.php'
14+
- '**phpcs.xml.dist'
15+
- '**composer.json'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
24+
coding-styles:
25+
runs-on: ubuntu-latest
26+
if: ${{ !contains(github.event.head_commit.message, 'skip cs') }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: 8.1
36+
coverage: none
37+
tools: cs2pr
38+
39+
- name: Adjust Composer dependencies
40+
run: |
41+
composer remove --dev --no-update "*/*"
42+
composer require --dev --no-update "inpsyde/php-coding-standards:^2"
43+
44+
- name: Install dependencies
45+
uses: ramsey/composer-install@v3
46+
47+
- name: Check code styles
48+
run: ./vendor/bin/phpcs -q ${{ ((github.event_name == 'pull_request') && '--report-checkstyle="phpcs-report.xml" ') || '' }}--report-full --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1
49+
50+
- name: Annotate code styles for PRs
51+
if: ${{ github.event_name == 'pull_request' }}
52+
run: cs2pr --graceful-warnings phpcs-report.xml

.github/workflows/php-lint.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PHP Lint
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/php-lint.yml'
7+
- '**.php'
8+
pull_request:
9+
paths:
10+
- '**workflows/php-lint.yml'
11+
- '**.php'
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
lint:
21+
runs-on: ubuntu-latest
22+
if: ${{ !contains(github.event.head_commit.message, 'skip lint') }}
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
php-ver: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php-ver }}
35+
ini-values: zend.assertions=1, error_reporting=E_ALL, display_errors=On
36+
tools: parallel-lint
37+
38+
- name: Check syntax error in sources
39+
run: parallel-lint ./src/

.github/workflows/php-qa.yml

Lines changed: 0 additions & 134 deletions
This file was deleted.

.github/workflows/php-sa.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: PHP Static Analysis
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/php-sa.yml'
7+
- '**.php'
8+
- '**phpstan.neon'
9+
- '**composer.json'
10+
pull_request:
11+
paths:
12+
- '**workflows/php-sa.yml'
13+
- '**.php'
14+
- '**phpstan.neon'
15+
- '**composer.json'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
24+
unit-tests:
25+
runs-on: ubuntu-latest
26+
if: ${{ !contains(github.event.head_commit.message, 'skip sa') }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
php-ver: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
31+
composer-ver: [ '~2.3.0', '^2' ]
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-ver }}
41+
ini-values: zend.assertions=1, error_reporting=E_ALL, display_errors=On
42+
coverage: none
43+
44+
- name: Adjust Composer dependencies
45+
run: |
46+
composer remove --dev --no-update "*/*"
47+
composer require --dev --no-update "composer/composer:${{ matrix.composer-ver }}"
48+
composer require --dev --no-update "symfony/process:^5.4||^6||^7"
49+
composer require --dev --no-update "phpstan/phpstan:^2"
50+
composer require --dev --no-update "phpstan/phpstan-strict-rules:^2"
51+
52+
- name: Install dependencies
53+
uses: ramsey/composer-install@v3
54+
55+
- name: Run tests
56+
run: ./vendor/bin/phpstan

.github/workflows/php-tests.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: PHP Tests
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/php-tests.yml'
7+
- '**.php'
8+
- '**templates/**'
9+
- '**phpunit.xml.dist'
10+
- '**composer.json'
11+
pull_request:
12+
paths:
13+
- '**workflows/php-tests.yml'
14+
- '**.php'
15+
- '**templates/**'
16+
- '**phpunit.xml.dist'
17+
- '**composer.json'
18+
workflow_dispatch:
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
26+
unit-tests:
27+
runs-on: ubuntu-latest
28+
if: ${{ !contains(github.event.head_commit.message, 'skip tests') }}
29+
env:
30+
USE_COVERAGE: no
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php-ver: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
35+
composer-ver: [ '~2.3.0', '~2.4.0', '~2.5.0', '~2.6.0', '~2.7.0', '~2.8.0' ]
36+
37+
steps:
38+
- name: Update "USE_COVERAGE" env var based on matrix
39+
if: ${{ matrix.php-ver == '8.1' && matrix.composer-ver == '~2.8.0' }}
40+
run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV
41+
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Setup PHP
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: ${{ matrix.php-ver }}
49+
ini-values: zend.assertions=1, error_reporting=E_ALL, display_errors=On
50+
coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }}
51+
52+
- name: Adjust Composer dependencies
53+
run: |
54+
composer remove --dev --no-update "roave/security-advisories"
55+
composer remove --dev --no-update "inpsyde/php-coding-standards"
56+
composer remove --dev --no-update "phpstan/phpstan"
57+
composer remove --dev --no-update "phpstan/phpstan-strict-rules"
58+
composer require --dev --no-update "composer/composer:${{ matrix.composer-ver }}"
59+
60+
- name: Install dependencies
61+
uses: ramsey/composer-install@v3
62+
63+
- name: Run tests
64+
run: ./vendor/bin/phpunit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-html=coverage-report') || '--no-coverage' }}
65+
66+
- name: Upload coverage report
67+
uses: actions/upload-artifact@v4
68+
if: ${{ env.USE_COVERAGE == 'yes' }}
69+
with:
70+
name: coverage-report
71+
path: coverage-report/

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,8 @@ WP Starter is the easiest and fastest way to bootstrap WordPress sites entirely
1313

1414
# System Requirements
1515

16-
- PHP 7.1+
17-
- [Composer](https://getcomposer.org/) >= 1.10
18-
19-
20-
21-
### Composer - PHP Support Table
22-
23-
| Composer ↓ / PHP → | 7.1 | 7.2 | 7.3 | 7.4 | 8.0 | 8.1 | 8.2 |
24-
| :----------------: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
25-
| 1.10 |||||| - | - |
26-
| 2.0 |||||| - | - |
27-
| 2.1 ||||||| - |
28-
| 2.2 ||||||||
29-
| 2.3 | - |||||||
30-
| 2.4 | - |||||||
31-
| 2.5 | - |||||||
16+
- PHP 7.4+
17+
- [Composer](https://getcomposer.org/) 2.3+
3218

3319

3420

0 commit comments

Comments
 (0)