Upgrade php 8.3#2
Merged
Merged
Conversation
Drop PHP 8.0-8.2 in favor of PHP 8.3/8.4/8.5 and upgrade the dev tooling: PHPUnit 9 -> 12, PHPStan 1 -> 2, and add Rector 2. - composer.json: php ^8.3; phpunit ^12, phpstan ^2, rector ^2; move friendsofphp/php-cs-fixer out of tools/ into require-dev; add rector scripts; fix csfix to use php-cs-fixer's --rules=@psr2. - phpunit.xml: migrate to the PHPUnit 12 schema (drop removed attributes, move source coverage into <source>). - phpstan.neon: drop removed checkGenericClassInNonGenericObjectType key. - rector.php: PHP 8.3 set + code-quality/dead-code/type-declaration/ early-return; skip ReadOnlyPropertyRector and CallableCollection promotion. - src: #[\Override] attributes, readonly value objects, ::class over get_class(), constructor promotion, typed properties, strict_types. - Dockerfile: base php:8.3-fpm; fix two pre-existing bugs (swallowed Composer install and clobbered xdebug ini that disabled coverage). - CI: matrix 8.3/8.4/8.5, bump actions to v4, drop deprecated --no-suggest, run rector:dry; docs.yml pins PHP via setup-php. Note: making value-object properties readonly is a minor BC break. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the consumer-facing changes for 2.0 (PHP 8.3+ requirement and the readonly value objects) and wire it into the couscous menu. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…iners Invoker::getActualCallable() looked up every callable-looking string in the container without first checking has(). A spec-compliant PSR-11 container (such as Laravel's) throws NotFoundException when get() is called for an unbound id, so a plain function name like 'trim' or a 'Class::method' string would blow up instead of being used directly. Guard the container lookup with has() so unbound callable strings fall through and are used as-is, while bound callable names still resolve from the container. This is behaviour-preserving for the lenient test container (has() already returns false for unbound ids) and makes the lookup PSR-11 correct. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Provide a first-class, optional Laravel bridge under Sirius\Invokator\Laravel
(core stays framework-agnostic):
- SiriusInvokatorServiceProvider wires Laravel's container into the Invoker as
its PSR-11 container and registers the processors and event dispatcher as
singletons so registrations persist.
- Invokator facade + InvokatorManager: pipeline/action/filter/middleware
('id') return a chainable Registrar to define callables, or run when given
args; events use PSR-14 object dispatch (event(Class)->add(), dispatch()).
- do_pipeline/do_action/do_filter/do_middleware/do_event global helpers
(do_-prefixed to avoid clashing with Laravel's event()/action()), loaded from
the provider so non-Laravel users get no global pollution.
- @do_action Blade directive.
Tested with orchestra/testbench across the CI matrix; the CI cache key now
includes the PHP version and composer.json hash so each leg resolves its own
dependencies.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move php-cs-fixer to a committed .php-cs-fixer.dist.php config that layers fully_qualified_strict_types (import_symbols), no_unused_imports and ordered_imports on top of @psr12, and point the csfix script at it. Apply the result: FQCN references (including the FQN return types Rector emitted) are imported and shortened across src/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a docs page covering installation/auto-discovery, the Invokator facade (define vs run, pipelines/actions/filters/middlewares, PSR-14 events), the do_* helpers, the @do_action Blade directive, and how string callables are resolved through Laravel's container. Add an "Integrations" section to the couscous menu. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PHPStan level 9 on PHP 8.4/8.5 reports missingType.iterableValue for the __serialize(): array return type, because the SplPriorityQueue parent stub differs there and no typed return is inherited. Declare the value type explicitly so analysis passes on every supported PHP version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the library to PHP 8.3+, refreshes the dev tooling, and adds an optional Laravel integration. Six commits, each self-contained.
Core upgrade
9 → 12, PHPStan1 → 2(kept at level 9), added Rector 2.#[\Override]attributes,readonlyvalue objects,::classoverget_class(), constructor promotion, native types.phpunit.xmlmigrated to the v12 schema.php:8.3-fpm— also fixes two pre-existing bugs in it (a swallowed Composer install and a clobbered xdebug ini that disabled coverage).composer.jsonhash so each leg resolves its own deps.Laravel integration (optional,
Sirius\Invokator\Laravel)The core stays framework-agnostic; the bridge only loads inside a Laravel app and is auto-discovered.
SiriusInvokatorServiceProviderinjects Laravel's container into theInvokeras its PSR-11 container; processors and the event dispatcher are registered as singletons so registrations persist.Invokatorfacade +do_*helpers (do_pipeline/do_action/do_filter/do_middleware/do_event, prefixed to avoid clashing with Laravel'sevent()/action()).@do_actionBlade directive; filters via{{ do_filter(...) }}.pipeline('id')returns a builder;pipeline('id', ...$args)runs). Events use PSR-14 object dispatch.orchestra/testbenchacross the full 8.3/8.4/8.5 matrix.Fix
Invoker::getActualCallable()now guards the container lookup withhas(), so plain function-name string callables ('trim') andClass::methodstrings work with strict PSR-11 containers (e.g.Laravel's), not just the lenient test container. Behaviour-preserving for existing usage and PSR-11 correct.
Tooling & docs
.php-cs-fixer.dist.php) that imports and shortens fully-qualified class names, applied acrosssrc/.⚠ Breaking changes
readonly— a minor BC break if any consumer reassigned them after construction. See the Upgrading to 2.0 doc.Testing