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
21 changes: 11 additions & 10 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/docs export-ignore
/.github export-ignore
/.editorconfig export-ignore
# Keep development-only files out of the distributed package.
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.phpunit-watcher.yml export-ignore
/CHANGELOG.md export-ignore
/docs.md export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/tests export-ignore
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2

updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 5
labels:
- dependencies
# The library itself only requires php-parser. Everything else here is test
# tooling, and the CI matrix already pins the Laravel versions it exercises.
ignore:
- dependency-name: "orchestra/testbench"
update-types: ["version-update:semver-major"]

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
labels:
- dependencies
140 changes: 65 additions & 75 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,95 @@
name: tests

on: [push, pull_request]

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist -o -n"
on:
push:
branches: [master]
pull_request:
workflow_dispatch:

jobs:
laravel-tests:
tests:
strategy:
fail-fast: false
matrix:
php-version: [7.4, 8.0]
laravel-version: [6, 7, 8]
os: [ubuntu-latest]
experimental: [false]
dependencies: [locked]
include:
- php-version: 7.4
laravel-version: 8
dependencies: highest
os: ubuntu-latest
experimental: false

# - php-version: 7.4
# laravel-version: 8
# os: windows-latest
# dependencies: locked
# experimental: false

- php-version: 7.4
laravel-version: 8
os: macos-latest
dependencies: locked
experimental: false

name: PHP ${{ matrix.php-version }} - L${{ matrix.laravel-version }} - ${{ matrix.os }} - ${{ matrix.dependencies }}
# Laravel 10 (testbench 8)
- { php: '8.1', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
- { php: '8.2', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
- { php: '8.3', laravel: '10.*', testbench: '8.*', os: ubuntu-latest }
# Laravel 11 (testbench 9)
- { php: '8.2', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
- { php: '8.3', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
- { php: '8.4', laravel: '11.*', testbench: '9.*', os: ubuntu-latest }
# Laravel 12 (testbench 10)
- { 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 }
# 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 }
# Keep an eye on the other host we claim to work on
- { php: '8.4', laravel: '12.*', testbench: '10.*', os: macos-latest }

name: PHP ${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}

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

continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
coverage: none
ini-values: "memory_limit=-1"
tools: composer
ini-values: memory_limit=-1, error_reporting=E_ALL
tools: composer:v2

- name: Determine composer cache directory
id: determine-composer-cache-directory
run: 'echo "::set-output name=directory::$(composer config cache-dir)"'
id: composer-cache
run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.determine-composer-cache-directory.outputs.directory }}
key: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
path: ${{ steps.composer-cache.outputs.directory }}
key: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-${{ hashFiles('composer.json') }}
restore-keys: composer-${{ matrix.os }}-php${{ matrix.php }}-laravel${{ matrix.laravel }}-

- name: Allow installing EOL Laravel branches
# Laravel 10 and 11 are past security support, so every release in those
# branches carries an open advisory and Composer 2.9+ declines to install
# them at all. This is a compatibility matrix rather than a deployment,
# and plenty of applications are still on those versions, so we want to
# know whether Archetype works there. Laravel 12 installs unmodified.
if: matrix.laravel != '12.*'
run: composer config policy.advisories.block false

- name: Install dependencies
run: |
composer require --dev --no-update --no-interaction \
"laravel/framework:${{ matrix.laravel }}" \
"orchestra/testbench:${{ matrix.testbench }}"
composer update --prefer-dist --no-interaction --no-progress

- name: Install highest dependencies from composer.json
if: matrix.dependencies == 'highest'
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}
- name: Run tests
run: vendor/bin/pest

- name: Install lowest dependencies from composer.json
if: matrix.dependencies == 'lowest'
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer install ${{ env.COMPOSER_FLAGS }} --prefer-lowest
static-analysis:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

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

- name: Run tests
run: vendor/bin/pest --verbose
- run: vendor/bin/phpstan analyse --no-progress
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ sketches/
.vscode/
vendor/
.phpunit.result.cache
.phpunit.cache/
logs
composer.lock
73 changes: 73 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Changelog

All notable changes to `ajthinking/archetype` are documented here.

This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.1] - 2026-08-25

Maintenance only. No API changes, and nothing here can break existing usage.

### Added

- Support for PHP 8.1 through 8.4, and for Laravel 10, 11, 12 and 13 — now
verified in CI across twelve combinations rather than assumed. Laravel 13 is
included because `statamic/cms` 6 already allows it.
- A `php` requirement (`^8.1`) in `composer.json`. The package never declared
one, so Composer could not warn anybody. 8.1 is the floor the code actually
needs and the whole range CI exercises; the upper bound is deliberate, because
PHP 9 removes dynamic properties and the AST node-identity mechanism still
relies on them.
- `LICENSE.md`. The package has always been MIT; the file was missing.
- This changelog.
- `.github/dependabot.yml`, so dependency updates are configured rather than
running on defaults.

### Changed

- The test suite now runs against a pinned application skeleton in
`tests/fixtures/laravel` instead of copying one out of `vendor/laravel/laravel`
at runtime. Laravel 11 removed most of the files the suite relied on
(`app/Console/Kernel.php`, `app/Exceptions/Handler.php`, `RouteServiceProvider`
and the middleware), which made the old approach untestable on current Laravel.
`laravel/laravel` is no longer a dev dependency.
- CI runs on `actions/checkout@v4` and `actions/cache@v4`, and no longer uses the
`::set-output` command that GitHub has disabled.
- `phpunit.xml` migrated to the PHPUnit 10+ schema.
- `Archetype\Tests\` moved out of the production autoloader into `autoload-dev`.
- `minimum-stability` is now `stable`.

### Fixed

- Seven implicit-nullable parameters that raised deprecation notices on PHP 8.4
(`PHPFile::namespace()`, `Namespace_::namespace()`, `FileInput::load()`,
`InputInterface::load()`, `EndpointProvider::__construct()`,
`PHPParserPropertyMap::propertyMap()` and `ASTQueryBuilder::traverseIntoClass()`).
- `getReflection()` now catches `Throwable` rather than `Exception`. A file whose
parent class or trait cannot be autoloaded raises an `Error`, which previously
escaped and killed the entire query instead of skipping that one file. This
affects `LaravelFile::models()`, `controllers()` and `serviceProviders()`.
- `tests/Pest.php` no longer defines a global `context()` helper. Laravel 11 ships
its own `context()`, and the collision brought the whole suite down before a
single test could run.

## [2.0.0] - 2024-05-11

### Changed

- **Breaking:** upgraded to `nikic/php-parser` ^5.0. Thanks to @jasonvarga (#85).

## [1.1.5] - 2022-08-24

Last release of the 1.x line, which requires `nikic/php-parser` ^4.11.

1.x cannot be installed alongside anything that needs php-parser 5 — including
Pest 3 and newer. If Composer refuses to resolve `ajthinking/archetype`, upgrade
to 2.x.

[Unreleased]: https://github.com/ajthinking/archetype/compare/v2.0.1...HEAD
[2.0.1]: https://github.com/ajthinking/archetype/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/ajthinking/archetype/compare/v1.1.5...v2.0.0
[1.1.5]: https://github.com/ajthinking/archetype/releases/tag/v1.1.5
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright (c) Anders Jürisoo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 25 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
}
],
"require": {
"php": "^8.1",
"nikic/php-parser": "^5.0"
},
"require-dev": {
"laravel/laravel": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0",
"pestphp/pest": "^1.21",
"phpstan/phpstan": "^1.6",
"phpunit/phpunit": "^8.0 || ^9.5"
"orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0",
"pestphp/pest": "^2.0 || ^3.0",
"phpstan/phpstan": "^1.11 || ^2.0"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -44,15 +43,30 @@
},
"autoload": {
"psr-4": {
"Archetype\\": "src/",
"Archetype\\Tests\\": "tests/"
}
"Archetype\\": "src/"
},
"exclude-from-classmap": [
"src/snippets/"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
"Archetype\\Tests\\": "tests/",
"App\\": "tests/fixtures/laravel/app/"
},
"files": [
"tests/stubs/laravel-sanctum.php"
],
"exclude-from-classmap": [
"tests/fixtures/laravel/database/",
"tests/fixtures/laravel/public/",
"tests/stubs/"
]
},
"scripts": {
"test": "pest",
"analyse": "phpstan analyse"
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
6 changes: 5 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ parameters:
paths:
- src
- tests
excludePaths:
# A pinned copy of a Laravel application skeleton, used as test input.
# It is data for the parser, not code we maintain.
- tests/fixtures/*
ignoreErrors:
- '#Dummy not found#'
- '#Dummy not found#'
Loading
Loading