Skip to content

Commit 6d6b4fc

Browse files
authored
Merge pull request #87 from ajthinking/release/2.0.1
Maintenance release 2.0.1: support PHP 8.1–8.4 and Laravel 10–13
2 parents d2c5cd0 + da61e3c commit 6d6b4fc

48 files changed

Lines changed: 1047 additions & 154 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: 65 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,95 @@
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+
# Laravel 13 (testbench 11, PHP 8.3+). statamic/cms 6 allows ^13.0,
28+
# so this is a version real downstream users are already on.
29+
- { php: '8.3', laravel: '13.*', testbench: '11.*', os: ubuntu-latest }
30+
- { php: '8.4', laravel: '13.*', testbench: '11.*', os: ubuntu-latest }
31+
# Keep an eye on the other host we claim to work on
32+
- { php: '8.4', laravel: '12.*', testbench: '10.*', os: macos-latest }
33+
34+
name: PHP ${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}
3835

3936
runs-on: ${{ matrix.os }}
4037

41-
continue-on-error: ${{ matrix.experimental }}
42-
4338
steps:
4439
- name: Checkout code
45-
uses: actions/checkout@v2
40+
uses: actions/checkout@v4
4641

4742
- name: Setup PHP
4843
uses: shivammathur/setup-php@v2
4944
with:
50-
php-version: ${{ matrix.php-version }}
45+
php-version: ${{ matrix.php }}
5146
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
5247
coverage: none
53-
ini-values: "memory_limit=-1"
54-
tools: composer
48+
ini-values: memory_limit=-1, error_reporting=E_ALL
49+
tools: composer:v2
5550

5651
- name: Determine composer cache directory
57-
id: determine-composer-cache-directory
58-
run: 'echo "::set-output name=directory::$(composer config cache-dir)"'
52+
id: composer-cache
53+
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"
5954

6055
- name: Cache dependencies
61-
uses: actions/cache@v2
56+
uses: actions/cache@v4
6257
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"
69-
70-
- name: Setup problem matchers for PHPUnit
71-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
58+
path: ${{ steps.composer-cache.outputs.directory }}
59+
key: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-${{ hashFiles('composer.json') }}
60+
restore-keys: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-
61+
62+
- name: Allow installing EOL Laravel branches
63+
# Laravel 10 and 11 are past security support, so every release in those
64+
# branches carries an open advisory and Composer 2.9+ declines to install
65+
# them at all. This is a compatibility matrix rather than a deployment,
66+
# and plenty of applications are still on those versions, so we want to
67+
# know whether Archetype works there. Laravel 12 installs unmodified.
68+
if: matrix.laravel != '12.*'
69+
run: composer config policy.advisories.block false
70+
71+
- name: Install dependencies
72+
run: |
73+
composer require --dev --no-update --no-interaction \
74+
"laravel/framework:${{ matrix.laravel }}" \
75+
"orchestra/testbench:${{ matrix.testbench }}"
76+
composer update --prefer-dist --no-interaction --no-progress
7277
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 }}
78+
- name: Run tests
79+
run: vendor/bin/pest
8080

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
81+
static-analysis:
82+
name: PHPStan
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
8886

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

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
93+
- run: composer update --prefer-dist --no-interaction --no-progress
10394

104-
- name: Run tests
105-
run: vendor/bin/pest --verbose
95+
- 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: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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.1 through 8.4, and for Laravel 10, 11, 12 and 13 — now
16+
verified in CI across twelve combinations rather than assumed. Laravel 13 is
17+
included because `statamic/cms` 6 already allows it.
18+
- A `php` requirement (`^8.1`) in `composer.json`. The package never declared
19+
one, so Composer could not warn anybody. 8.1 is the floor the code actually
20+
needs and the whole range CI exercises; the upper bound is deliberate, because
21+
PHP 9 removes dynamic properties and the AST node-identity mechanism still
22+
relies on them.
23+
- `LICENSE.md`. The package has always been MIT; the file was missing.
24+
- This changelog.
25+
- `.github/dependabot.yml`, so dependency updates are configured rather than
26+
running on defaults.
27+
28+
### Changed
29+
30+
- The test suite now runs against a pinned application skeleton in
31+
`tests/fixtures/laravel` instead of copying one out of `vendor/laravel/laravel`
32+
at runtime. Laravel 11 removed most of the files the suite relied on
33+
(`app/Console/Kernel.php`, `app/Exceptions/Handler.php`, `RouteServiceProvider`
34+
and the middleware), which made the old approach untestable on current Laravel.
35+
`laravel/laravel` is no longer a dev dependency.
36+
- CI runs on `actions/checkout@v4` and `actions/cache@v4`, and no longer uses the
37+
`::set-output` command that GitHub has disabled.
38+
- `phpunit.xml` migrated to the PHPUnit 10+ schema.
39+
- `Archetype\Tests\` moved out of the production autoloader into `autoload-dev`.
40+
- `minimum-stability` is now `stable`.
41+
42+
### Fixed
43+
44+
- Seven implicit-nullable parameters that raised deprecation notices on PHP 8.4
45+
(`PHPFile::namespace()`, `Namespace_::namespace()`, `FileInput::load()`,
46+
`InputInterface::load()`, `EndpointProvider::__construct()`,
47+
`PHPParserPropertyMap::propertyMap()` and `ASTQueryBuilder::traverseIntoClass()`).
48+
- `getReflection()` now catches `Throwable` rather than `Exception`. A file whose
49+
parent class or trait cannot be autoloaded raises an `Error`, which previously
50+
escaped and killed the entire query instead of skipping that one file. This
51+
affects `LaravelFile::models()`, `controllers()` and `serviceProviders()`.
52+
- `tests/Pest.php` no longer defines a global `context()` helper. Laravel 11 ships
53+
its own `context()`, and the collision brought the whole suite down before a
54+
single test could run.
55+
56+
## [2.0.0] - 2024-05-11
57+
58+
### Changed
59+
60+
- **Breaking:** upgraded to `nikic/php-parser` ^5.0. Thanks to @jasonvarga (#85).
61+
62+
## [1.1.5] - 2022-08-24
63+
64+
Last release of the 1.x line, which requires `nikic/php-parser` ^4.11.
65+
66+
1.x cannot be installed alongside anything that needs php-parser 5 — including
67+
Pest 3 and newer. If Composer refuses to resolve `ajthinking/archetype`, upgrade
68+
to 2.x.
69+
70+
[Unreleased]: https://github.com/ajthinking/archetype/compare/v2.0.1...HEAD
71+
[2.0.1]: https://github.com/ajthinking/archetype/compare/v2.0.0...v2.0.1
72+
[2.0.0]: https://github.com/ajthinking/archetype/compare/v1.1.5...v2.0.0
73+
[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": "^8.1",
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 || ^11.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)