diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df20875..0ee6a05 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,10 +24,12 @@ jobs: - { php: '8.2', laravel: '12.*', testbench: '10.*', os: ubuntu-latest } - { php: '8.3', laravel: '12.*', testbench: '10.*', os: ubuntu-latest } - { php: '8.4', laravel: '12.*', testbench: '10.*', os: ubuntu-latest } + - { php: '8.5', laravel: '12.*', testbench: '10.*', os: ubuntu-latest } # Laravel 13 (testbench 11, PHP 8.3+). statamic/cms 6 allows ^13.0, # so this is a version real downstream users are already on. - { php: '8.3', laravel: '13.*', testbench: '11.*', os: ubuntu-latest } - { php: '8.4', laravel: '13.*', testbench: '11.*', os: ubuntu-latest } + - { php: '8.5', laravel: '13.*', testbench: '11.*', os: ubuntu-latest } # Keep an eye on the other host we claim to work on - { php: '8.4', laravel: '12.*', testbench: '10.*', os: macos-latest } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d5fa21..941e067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,23 @@ This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +Proposed as 2.1.0: no API changes, but the php-parser floor rises. + +### Added + +- Support for PHP 8.5 (CI runs 8.5 against Laravel 12 and 13). The suite + passes unmodified on PHP 8.5.12, the current security release. +- Files written in PHP 8.5 syntax (pipe operator `|>`, `(void)` casts, + `final` promoted properties, `#[\NoDiscard]`) can be loaded, edited and + rendered. A round-trip test covers this. + +### Changed + +- `nikic/php-parser` is now required at `^5.6` instead of `^5.0`. Archetype + parses with php-parser's newest supported version, and 5.5 and older reject + PHP 8.5 syntax with a parse error. Composer upgrades php-parser within 5.x, + and nothing changes in your own code. + ## [2.0.1] - 2026-08-25 Maintenance only. No API changes, and nothing here can break existing usage. diff --git a/composer.json b/composer.json index 3795160..6e73891 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": "^8.1", - "nikic/php-parser": "^5.0" + "nikic/php-parser": "^5.6" }, "require-dev": { "orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0", diff --git a/readme.md b/readme.md index e900a38..918f2b7 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@ That's it! Check out introduction of concepts below or review the [API examples] | Archetype | PHP | Laravel | php-parser | | --------- | ------- | -------- | ---------- | -| 2.x | 8.1–8.4 | 10, 11, 12, 13 | ^5.0 | +| 2.x | 8.1–8.5 | 10, 11, 12, 13 | ^5.6 | | 1.x | 7.4–8.1 | 6–9 | ^4.11 | > **On 1.x?** Upgrade to 2.x. Version 1 pins `nikic/php-parser` to `^4.11`, which diff --git a/tests/Feature/Php85SyntaxTest.php b/tests/Feature/Php85SyntaxTest.php new file mode 100644 index 0000000..e3eeb14 --- /dev/null +++ b/tests/Feature/Php85SyntaxTest.php @@ -0,0 +1,49 @@ +input |> trim(...) |> strtolower(...); + } + + public function run(): void + { + (void) $this->slug(); + } +} +PHP; + +it('can load and edit a file using php 8.5 syntax', function() use ($php85) { + $output = PHPFile::fromString($php85) + ->className('RenamedPipeline') + ->add()->property('extra', 1) + ->assertValidPhp() + ->render(); + + expect($output) + ->toContain('class RenamedPipeline') + ->toContain('|> trim(...) |> strtolower(...)') + ->toContain('(void) $this->slug()') + ->toContain('final public string $input') + ->toContain('#[\NoDiscard]'); +});