Skip to content

Commit 21989d3

Browse files
committed
Refresh PHP 8.0 docs and CI
1 parent f72c2e2 commit 21989d3

6 files changed

Lines changed: 111 additions & 56 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ php8.0 ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ php8.0 ]
88

99
jobs:
1010
tests:
@@ -15,10 +15,10 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

18-
- name: Setup PHP 8.3 with Xdebug
18+
- name: Setup PHP 8.0 with Xdebug
1919
uses: shivammathur/setup-php@v2
2020
with:
21-
php-version: '8.3'
21+
php-version: '8.0'
2222
tools: composer:v2
2323
coverage: xdebug
2424

@@ -45,6 +45,8 @@ jobs:
4545
with:
4646
token: ${{ secrets.CODECOV_TOKEN }}
4747
files: ./coverage.xml
48+
flags: php8.0
49+
name: php8.0
4850
fail_ci_if_error: true
4951
env:
5052
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Static Analysis
2+
3+
on:
4+
push:
5+
branches: [ php8.0 ]
6+
pull_request:
7+
branches: [ php8.0 ]
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP 8.0
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.0'
22+
tools: composer:v2
23+
coverage: none
24+
25+
- name: Validate composer.json
26+
run: composer validate --strict
27+
28+
- name: Install dependencies
29+
run: composer update --prefer-dist --no-interaction --no-progress
30+
31+
- name: Run PHPStan
32+
run: composer phpstan-check

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# XmlExtractKit
22

3-
[![Packagist Version](https://img.shields.io/packagist/v/sbwerewolf/xml-navigator?label=packagist)](https://packagist.org/packages/sbwerewolf/xml-navigator)
4-
[![Packagist Downloads](https://img.shields.io/packagist/dt/sbwerewolf/xml-navigator)](https://packagist.org/packages/sbwerewolf/xml-navigator)
5-
[![PHP 8.3+](https://img.shields.io/badge/PHP-8.3%2B-777BB4)](https://www.php.net/)
6-
[![Test Coverage](https://codecov.io/github/SbWereWolf/xml-navigator/graph/badge.svg?token=Q0BQ2COFTC)](https://codecov.io/github/SbWereWolf/xml-navigator)
3+
[![PHP 8.0-8.2](https://img.shields.io/badge/PHP-8.0--8.2-777BB4)](https://www.php.net/)
4+
[![Static Analysis](https://github.com/SbWereWolf/xml-navigator/actions/workflows/static-analysis.yml/badge.svg?branch=php8.0)](https://github.com/SbWereWolf/xml-navigator/actions/workflows/static-analysis.yml?query=branch%3Aphp8.0)
5+
[![Test Coverage](https://codecov.io/github/SbWereWolf/xml-navigator/graph/badge.svg?token=Q0BQ2COFTC&branch=php8.0)](https://codecov.io/github/SbWereWolf/xml-navigator/tree/php8.0)
76

87

98
**XmlExtractKit for PHP: Stream large XML, extract only what matters,
@@ -19,7 +18,7 @@ large XML → selected nodes → plain PHP arrays
1918
composer require sbwerewolf/xml-navigator
2019
```
2120

22-
For local test and coverage dependencies on a standard PHP 8.3 setup,
21+
For local test, coverage, and static-analysis dependencies for this branch,
2322
see [`tests/ENVIRONMENT.md`](tests/ENVIRONMENT.md).
2423

2524
## Why this package?
@@ -151,7 +150,7 @@ array (
151150

152151
## Code test coverage
153152

154-
![Codecov graph](https://codecov.io/github/SbWereWolf/xml-navigator/graphs/tree.svg?token=Q0BQ2COFTC)
153+
![Codecov graph](https://codecov.io/github/SbWereWolf/xml-navigator/graphs/tree.svg?token=Q0BQ2COFTC&branch=php8.0)
155154

156155

157156
## Working examples

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@
4343
"scripts": {
4444
"test": "php ./vendor/phpunit/phpunit/phpunit --configuration ./continuous-integration/phpunit/phpunit.xml --testdox --colors=always",
4545
"test-coverage": "php -d xdebug.mode=coverage ./vendor/phpunit/phpunit/phpunit --configuration ./continuous-integration/phpunit/phpunit.xml --testdox --colors=always --coverage-html ./continuous-integration/autotests-coverage-report --coverage-filter ./src",
46+
"phpstan-check": "php ./vendor/bin/phpstan analyse -vvv --configuration continuous-integration/phpstan/phpstan.neon",
4647
"check-style": "php ./vendor/bin/phpcs --standard=continuous-integration/phpcs/phpcs.xml -v",
4748
"fix-style": "php ./vendor/bin/phpcbf --standard=continuous-integration/phpcs/phpcs.xml -v"
4849
},
4950
"require-dev": {
5051
"phpunit/phpunit": "^9.6",
52+
"phpstan/phpstan": "^2.1",
5153
"squizlabs/php_codesniffer": "^3.13",
5254
"sbwerewolf/json-serialize-trait": "^1"
5355
},

composer.lock

Lines changed: 55 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/ENVIRONMENT.md

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
# Test Environment for Standard PHP 8.3
1+
# Test Environment for Standard PHP 8.0
22

3-
This repository expects a standard PHP 8.3 CLI environment with the
4-
dependencies required for XML processing, PHPUnit, style fixing, and
5-
coverage.
3+
This branch expects a standard PHP 8.0 CLI environment with the
4+
dependencies required for XML processing, PHPUnit, PHPStan, style
5+
fixing, and coverage.
66

77
## Required dependencies
88

99
At minimum, make sure the system provides:
1010

11-
- PHP 8.3 CLI
11+
- PHP 8.0 CLI
1212
- XML / XMLReader support
1313
- Composer
1414
- Xdebug
1515

1616
Typical package names on Linux distributions look like:
1717

18-
- `php8.3-cli`
19-
- `php8.3-xml`
20-
- `php8.3-xdebug`
18+
- `php8.0-cli`
19+
- `php8.0-xml`
20+
- `php8.0-xdebug`
2121
- `composer`
2222

2323
Exact package names can differ by platform or package manager, but the
24-
runtime expectation stays the same: `php` must be a PHP 8.3 CLI binary
24+
runtime expectation stays the same: `php` must be a PHP 8.0 CLI binary
2525
with `xmlreader` and `xdebug` available.
2626

27-
## How coverage works in this repository
27+
## How coverage works in this branch
2828

29-
The repository does not require a global coverage mode in `ini` files.
3029
Coverage is enabled only for the dedicated command:
3130

3231
```bash
@@ -45,36 +44,6 @@ So the environment must satisfy two conditions:
4544
2. Coverage is enabled only at launch time through
4645
`-d xdebug.mode=coverage`.
4746

48-
49-
## Platform-specific preparation
50-
51-
Any platform-specific work to make CLI PHP load Xdebug should be done
52-
outside the repository commands.
53-
54-
### Linux
55-
56-
- install the PHP 8.3 CLI, XML, and Xdebug packages provided by your
57-
distribution or PPA;
58-
- enable the Xdebug extension for CLI PHP using the standard mechanism
59-
of that distribution;
60-
- verify that `php --ri xdebug` works before running coverage.
61-
62-
### macOS
63-
64-
- install PHP 8.3 and Xdebug using your package manager or the standard
65-
PHP distribution you use locally;
66-
- make sure the CLI `php` command loads Xdebug in its default config;
67-
- verify with `php --ri xdebug`.
68-
69-
### Windows
70-
71-
- use a PHP 8.3 build that includes or supports Xdebug;
72-
- enable Xdebug in the normal CLI PHP configuration;
73-
- verify with `php --ri xdebug`.
74-
75-
The repository assumes that by the time you run tests, these steps are
76-
already complete.
77-
7847
## Quick verification
7948

8049
Check the loaded extensions:
@@ -89,8 +58,6 @@ Then run:
8958
```bash
9059
composer test
9160
composer test-coverage
61+
composer phpstan-check
9262
composer fix-style
9363
```
94-
95-
If `composer test-coverage` fails because Xdebug is missing, fix the
96-
platform configuration first instead of changing the test command.

0 commit comments

Comments
 (0)