Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 49 additions & 0 deletions tests/Feature/Php85SyntaxTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use Archetype\Tests\Support\Facades\TestablePHPFile as PHPFile;

// Archetype parses with php-parser's newest supported version rather than the
// host's, so a file using PHP 8.5 syntax must survive a load/edit/render round
// trip whichever PHP runs the tests.
$php85 = <<<'PHP'
<?php

namespace App;

#[\Attribute]
final class Pipeline
{
#[\Deprecated]
public const string NAME = 'pipeline';

public function __construct(final public string $input)
{
}

#[\NoDiscard]
public function slug(): string
{
return $this->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]');
});
Loading