Skip to content

Commit a7201e5

Browse files
ajthinkingclaude
andcommitted
Maintenance release 2.0.1
Support PHP 8.2-8.4 and Laravel 10-12, and prove it in CI. v2.0.0 shipped the php-parser 5 port having never been tested against any PHP or Laravel version currently in use; the workflow still targeted PHP 7.4/8.0 with Laravel 6/7/8 and had not run since May 2024. No API changes. Nothing here can break existing usage. Testing - Pin the application skeleton the suite asserts against into tests/fixtures/laravel instead of copying one out of vendor/laravel/laravel at runtime. Laravel 11 deleted most of the files the suite relied on (app/Console/Kernel.php, app/Exceptions/Handler.php, RouteServiceProvider, the middleware), so the old approach could not run on current Laravel at all. Drops the laravel/laravel dev dependency. - Stop defining a global context() helper in tests/Pest.php. Laravel 11 ships its own, and the collision took the suite down before a single test ran. - Rebuild the CI matrix: ten PHP x Laravel combinations, checkout@v4, cache@v4, and no more of GitHub's disabled ::set-output. Add a PHPStan job. - Migrate phpunit.xml to the PHPUnit 10+ schema. Fixes - Map the 'throw' AST node to Expr\Throw_. php-parser 5 removed Stmt\Throw_, so ->throw() had silently matched nothing since 2.0.0. Caught by PHPStan, now covered by a test. - Catch Throwable rather than Exception in getReflection(). A file whose parent class or trait cannot be autoloaded raises an Error, which escaped and killed the whole query instead of skipping that one file. Affects LaravelFile::models(), controllers() and serviceProviders(). - Declare seven implicit-nullable parameters explicitly, silencing the deprecation notices they raise on PHP 8.4. - Correct commands_root and controllers_root in the shipped config, which both pointed at app/HTTP/Controllers. Packaging - Declare a php requirement. There was none. - Add LICENSE.md. The package has always been MIT; the file was missing. - Add CHANGELOG.md and .github/dependabot.yml. - Move Archetype\Tests\ out of the production autoloader. - Set minimum-stability to stable. - Refresh .gitattributes, which referenced files that no longer exist and missed ones that do. Readme now states supported versions and tells 1.x users why Composer refuses to resolve for them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d2c5cd0 commit a7201e5

48 files changed

Lines changed: 1026 additions & 146 deletions

Some content is hidden

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

.gitattributes

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Path-based git attributes
22
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
33

4-
# Ignore all test and documentation with "export-ignore".
5-
/.gitattributes export-ignore
6-
/.gitignore export-ignore
7-
/.travis.yml export-ignore
8-
/phpunit.xml.dist export-ignore
9-
/.scrutinizer.yml export-ignore
10-
/tests export-ignore
11-
/docs export-ignore
12-
/.github export-ignore
13-
/.editorconfig export-ignore
4+
# Keep development-only files out of the distributed package.
5+
/.editorconfig export-ignore
6+
/.gitattributes export-ignore
7+
/.github export-ignore
8+
/.gitignore export-ignore
9+
/.phpunit-watcher.yml export-ignore
10+
/CHANGELOG.md export-ignore
11+
/docs.md export-ignore
12+
/phpstan.neon export-ignore
13+
/phpunit.xml export-ignore
14+
/tests export-ignore

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: composer
5+
directory: "/"
6+
schedule:
7+
interval: monthly
8+
open-pull-requests-limit: 5
9+
labels:
10+
- dependencies
11+
# The library itself only requires php-parser. Everything else here is test
12+
# tooling, and the CI matrix already pins the Laravel versions it exercises.
13+
ignore:
14+
- dependency-name: "orchestra/testbench"
15+
update-types: ["version-update:semver-major"]
16+
17+
- package-ecosystem: github-actions
18+
directory: "/"
19+
schedule:
20+
interval: monthly
21+
labels:
22+
- dependencies

.github/workflows/tests.yml

Lines changed: 51 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,82 @@
11
name: tests
22

3-
on: [push, pull_request]
4-
5-
env:
6-
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist -o -n"
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
workflow_dispatch:
78

89
jobs:
9-
laravel-tests:
10+
tests:
1011
strategy:
1112
fail-fast: false
1213
matrix:
13-
php-version: [7.4, 8.0]
14-
laravel-version: [6, 7, 8]
15-
os: [ubuntu-latest]
16-
experimental: [false]
17-
dependencies: [locked]
1814
include:
19-
- php-version: 7.4
20-
laravel-version: 8
21-
dependencies: highest
22-
os: ubuntu-latest
23-
experimental: false
24-
25-
# - php-version: 7.4
26-
# laravel-version: 8
27-
# os: windows-latest
28-
# dependencies: locked
29-
# experimental: false
30-
31-
- php-version: 7.4
32-
laravel-version: 8
33-
os: macos-latest
34-
dependencies: locked
35-
experimental: false
36-
37-
name: PHP ${{ matrix.php-version }} - L${{ matrix.laravel-version }} - ${{ matrix.os }} - ${{ matrix.dependencies }}
15+
# Laravel 10 (testbench 8)
16+
- { php: '8.1', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
17+
- { php: '8.2', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
18+
- { php: '8.3', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
19+
# Laravel 11 (testbench 9)
20+
- { php: '8.2', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
21+
- { php: '8.3', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
22+
- { php: '8.4', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
23+
# Laravel 12 (testbench 10)
24+
- { php: '8.2', laravel: '12.*', testbench: '10.*', os: ubuntu-latest }
25+
- { php: '8.3', laravel: '12.*', testbench: '10.*', os: ubuntu-latest }
26+
- { php: '8.4', laravel: '12.*', testbench: '10.*', os: ubuntu-latest }
27+
# Keep an eye on the other host we claim to work on
28+
- { php: '8.4', laravel: '12.*', testbench: '10.*', os: macos-latest }
29+
30+
name: PHP ${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}
3831

3932
runs-on: ${{ matrix.os }}
4033

41-
continue-on-error: ${{ matrix.experimental }}
42-
4334
steps:
4435
- name: Checkout code
45-
uses: actions/checkout@v2
36+
uses: actions/checkout@v4
4637

4738
- name: Setup PHP
4839
uses: shivammathur/setup-php@v2
4940
with:
50-
php-version: ${{ matrix.php-version }}
41+
php-version: ${{ matrix.php }}
5142
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
5243
coverage: none
53-
ini-values: "memory_limit=-1"
54-
tools: composer
44+
ini-values: memory_limit=-1, error_reporting=E_ALL
45+
tools: composer:v2
5546

5647
- name: Determine composer cache directory
57-
id: determine-composer-cache-directory
58-
run: 'echo "::set-output name=directory::$(composer config cache-dir)"'
48+
id: composer-cache
49+
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
5950

6051
- name: Cache dependencies
61-
uses: actions/cache@v2
52+
uses: actions/cache@v4
6253
with:
63-
path: ${{ steps.determine-composer-cache-directory.outputs.directory }}
64-
key: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-${{ hashFiles('**/composer.lock') }}
65-
restore-keys: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-
66-
67-
- name: Setup problem matchers for PHP
68-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
54+
path: ${{ steps.composer-cache.outputs.directory }}
55+
key: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-${{ hashFiles('composer.json') }}
56+
restore-keys: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-
6957

70-
- name: Setup problem matchers for PHPUnit
71-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
58+
- name: Install dependencies
59+
run: |
60+
composer require --dev --no-update --no-interaction \
61+
"laravel/framework:${{ matrix.laravel }}" \
62+
"orchestra/testbench:${{ matrix.testbench }}"
63+
composer update --prefer-dist --no-interaction --no-progress
7264
73-
- name: Install highest dependencies from composer.json
74-
if: matrix.dependencies == 'highest'
75-
uses: nick-invision/retry@v1
76-
with:
77-
timeout_minutes: 5
78-
max_attempts: 5
79-
command: composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}
65+
- name: Run tests
66+
run: vendor/bin/pest
8067

81-
- name: Install lowest dependencies from composer.json
82-
if: matrix.dependencies == 'lowest'
83-
uses: nick-invision/retry@v1
84-
with:
85-
timeout_minutes: 5
86-
max_attempts: 5
87-
command: composer install ${{ env.COMPOSER_FLAGS }} --prefer-lowest
68+
static-analysis:
69+
name: PHPStan
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
8873

89-
- name: Install dependencies from composer.lock
90-
if: matrix.dependencies == 'locked'
91-
uses: nick-invision/retry@v1
74+
- uses: shivammathur/setup-php@v2
9275
with:
93-
timeout_minutes: 5
94-
max_attempts: 5
95-
command: composer install ${{ env.COMPOSER_FLAGS }}
76+
php-version: '8.3'
77+
coverage: none
78+
tools: composer:v2
9679

97-
- name: Select Laravel version
98-
uses: nick-invision/retry@v1
99-
with:
100-
timeout_minutes: 5
101-
max_attempts: 5
102-
command: composer require "laravel/framework:${{ matrix.laravel-version }}.*" --no-update
80+
- run: composer update --prefer-dist --no-interaction --no-progress
10381

104-
- name: Run tests
105-
run: vendor/bin/pest --verbose
82+
- run: vendor/bin/phpstan analyse --no-progress

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ sketches/
66
.vscode/
77
vendor/
88
.phpunit.result.cache
9+
.phpunit.cache/
910
logs
1011
composer.lock

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Changelog
2+
3+
All notable changes to `ajthinking/archetype` are documented here.
4+
5+
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [2.0.1] - 2026-08-25
10+
11+
Maintenance only. No API changes, and nothing here can break existing usage.
12+
13+
### Added
14+
15+
- Support for PHP 8.2, 8.3 and 8.4, and for Laravel 10, 11 and 12 — now verified
16+
in CI across ten combinations rather than assumed.
17+
- A `php` requirement (`>=7.4`) in `composer.json`. The package never declared
18+
one, so Composer could not warn anybody.
19+
- `LICENSE.md`. The package has always been MIT; the file was missing.
20+
- This changelog.
21+
- `.github/dependabot.yml`, so dependency updates are configured rather than
22+
running on defaults.
23+
24+
### Changed
25+
26+
- The test suite now runs against a pinned application skeleton in
27+
`tests/fixtures/laravel` instead of copying one out of `vendor/laravel/laravel`
28+
at runtime. Laravel 11 removed most of the files the suite relied on
29+
(`app/Console/Kernel.php`, `app/Exceptions/Handler.php`, `RouteServiceProvider`
30+
and the middleware), which made the old approach untestable on current Laravel.
31+
`laravel/laravel` is no longer a dev dependency.
32+
- CI runs on `actions/checkout@v4` and `actions/cache@v4`, and no longer uses the
33+
`::set-output` command that GitHub has disabled.
34+
- `phpunit.xml` migrated to the PHPUnit 10+ schema.
35+
- `Archetype\Tests\` moved out of the production autoloader into `autoload-dev`.
36+
- `minimum-stability` is now `stable`.
37+
38+
### Fixed
39+
40+
- Six implicit-nullable parameters that raised deprecation notices on PHP 8.4
41+
(`PHPFile::namespace()`, `Namespace_::namespace()`, `FileInput::load()`,
42+
`InputInterface::load()`, `EndpointProvider::__construct()`,
43+
`PHPParserPropertyMap::propertyMap()` and `ASTQueryBuilder::traverseIntoClass()`).
44+
- `getReflection()` now catches `Throwable` rather than `Exception`. A file whose
45+
parent class or trait cannot be autoloaded raises an `Error`, which previously
46+
escaped and killed the entire query instead of skipping that one file. This
47+
affects `LaravelFile::models()`, `controllers()` and `serviceProviders()`.
48+
- `tests/Pest.php` no longer defines a global `context()` helper. Laravel 11 ships
49+
its own `context()`, and the collision brought the whole suite down before a
50+
single test could run.
51+
52+
## [2.0.0] - 2024-05-11
53+
54+
### Changed
55+
56+
- **Breaking:** upgraded to `nikic/php-parser` ^5.0. Thanks to @jasonvarga (#85).
57+
58+
## [1.1.5] - 2022-08-24
59+
60+
Last release of the 1.x line, which requires `nikic/php-parser` ^4.11.
61+
62+
1.x cannot be installed alongside anything that needs php-parser 5 — including
63+
Pest 3 and newer. If Composer refuses to resolve `ajthinking/archetype`, upgrade
64+
to 2.x.
65+
66+
[Unreleased]: https://github.com/ajthinking/archetype/compare/v2.0.1...HEAD
67+
[2.0.1]: https://github.com/ajthinking/archetype/compare/v2.0.0...v2.0.1
68+
[2.0.0]: https://github.com/ajthinking/archetype/compare/v1.1.5...v2.0.0
69+
[1.1.5]: https://github.com/ajthinking/archetype/releases/tag/v1.1.5

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) Anders Jürisoo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

composer.json

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
}
1818
],
1919
"require": {
20+
"php": ">=7.4",
2021
"nikic/php-parser": "^5.0"
2122
},
2223
"require-dev": {
23-
"laravel/laravel": "^6.0 || ^7.0 || ^8.0 || ^9.0",
24-
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0",
25-
"pestphp/pest": "^1.21",
26-
"phpstan/phpstan": "^1.6",
27-
"phpunit/phpunit": "^8.0 || ^9.5"
24+
"orchestra/testbench": "^8.0 || ^9.0 || ^10.0",
25+
"pestphp/pest": "^2.0 || ^3.0",
26+
"phpstan/phpstan": "^1.11 || ^2.0"
2827
},
2928
"config": {
3029
"optimize-autoloader": true,
@@ -44,15 +43,30 @@
4443
},
4544
"autoload": {
4645
"psr-4": {
47-
"Archetype\\": "src/",
48-
"Archetype\\Tests\\": "tests/"
49-
}
46+
"Archetype\\": "src/"
47+
},
48+
"exclude-from-classmap": [
49+
"src/snippets/"
50+
]
5051
},
5152
"autoload-dev": {
5253
"psr-4": {
53-
"Tests\\": "tests/"
54-
}
54+
"Archetype\\Tests\\": "tests/",
55+
"App\\": "tests/fixtures/laravel/app/"
56+
},
57+
"files": [
58+
"tests/stubs/laravel-sanctum.php"
59+
],
60+
"exclude-from-classmap": [
61+
"tests/fixtures/laravel/database/",
62+
"tests/fixtures/laravel/public/",
63+
"tests/stubs/"
64+
]
65+
},
66+
"scripts": {
67+
"test": "pest",
68+
"analyse": "phpstan analyse"
5569
},
56-
"minimum-stability": "dev",
70+
"minimum-stability": "stable",
5771
"prefer-stable": true
5872
}

phpstan.neon

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ parameters:
33
paths:
44
- src
55
- tests
6+
excludePaths:
7+
# A pinned copy of a Laravel application skeleton, used as test input.
8+
# It is data for the parser, not code we maintain.
9+
- tests/fixtures/*
610
ignoreErrors:
7-
- '#Dummy not found#'
11+
- '#Dummy not found#'

0 commit comments

Comments
 (0)