|
32 | 32 |
|
33 | 33 | ## Running tests |
34 | 34 |
|
| 35 | +## PHP version compatibility |
| 36 | + |
| 37 | +- Treat **PHP 5.6** as the minimum supported runtime for any code changes in this repo. |
| 38 | +- New formatter logic should avoid syntax/features newer than PHP 5.6 (e.g. scalar type hints, return types, null coalescing `??`, spaceship `<=>`, arrow functions, etc.). |
| 39 | +- Some fixtures and passes are intentionally **version-gated** (e.g. PHP 8 attributes, `match`, etc.) and will be skipped when running under older runtimes. |
| 40 | + |
35 | 41 | ### 1) Fixture tests (`.in`/`.out`) |
36 | 42 |
|
37 | 43 | - Run the full fixture suite: |
38 | 44 | - From `tests/`: `php ./run_all_tests.php` |
| 45 | + |
| 46 | +- If you don’t have PHP 5.6 locally, validate compatibility by running with PHP 7.4: |
| 47 | + - `php74 tests/run_all_tests.php` |
| 48 | + - If your system uses `php7.4` instead: `php7.4 tests/run_all_tests.php` |
39 | 49 | - Run a subset by test number prefix: |
40 | 50 | - `php ./run_all_tests.php --testNumber 525` |
41 | 51 | - Show diffs (verbose): |
|
73 | 83 | - Run from the repository root: |
74 | 84 | - `./vendor/bin/phpunit` |
75 | 85 |
|
| 86 | +- Under PHP 7.4 (if available): |
| 87 | + - `php74 ./vendor/bin/phpunit` |
| 88 | + |
| 89 | +Notes: |
| 90 | +- The **fixture harness** (`tests/run_all_tests.php`) is the primary “hard gate” for formatter behavior and should stay at `Broken:0`. |
| 91 | +- Under older runtimes (e.g. PHP 7.4), PHPUnit may report many **Skipped** tests due to runtime/dependency constraints; this is expected. |
| 92 | +- Prefer running PHPUnit with the default `php` (newer runtime) for full coverage, and use `php74 tests/run_all_tests.php` as the compatibility proxy. |
| 93 | + |
76 | 94 | ## Creating a new fixture test (`.in`/`.out`) |
77 | 95 |
|
78 | 96 | 1) Pick a new number |
|
100 | 118 | - `php tests/run_all_tests.php` |
101 | 119 | - `./vendor/bin/phpunit` |
102 | 120 |
|
| 121 | +- Also run the fixture suite with PHP 7.4 when possible (as a proxy for older runtimes): |
| 122 | + - `php74 tests/run_all_tests.php` |
| 123 | + |
103 | 124 | ## Debugging tips |
104 | 125 |
|
105 | 126 | - To see which passes execute, use `FMTDEBUG` (see conditions in `fmt.stub.php`). |
|
0 commit comments