Repository navigation
Rip out most of the magic and replace it with ->to() and ->toStatic(). For manager classes the magic remains. Rip out magic from View.php for dynamic with{Word}. ->with('{word}', $param) should be used instead.
·
92 commits
to production
since this release
Release Notes: Architectural Strictness & Magic Removal
Overview
This release introduces a massive architectural shift focused on strict typing, static analysis compliance, and the eradication of runtime "magic." By removing dynamic method interception and higher-order proxies, the framework provides more transparency to IDEs and static analysis tools (like PHPStan and Psalm).
💥 Breaking Changes
- Higher-Order Proxies Eliminated:
- All Higher-Order proxy classes (
HigherOrderBuilderProxy,HigherOrderCollectionProxy,HigherOrderTapProxy, andHigherOrderWhenProxy) have been permanently deleted. - You can no longer omit closures on collection/conditionable methods. Calls like
$collection->each->update(...),tap($user)->update(...), or$query->when($condition)->active()must now be written with explicit closures:$collection->each(fn($item) => $item->update(...)). - The
tap(),when(), andunless()methods now strictly require acallableargument.
- All Higher-Order proxy classes (
- Dynamic View Bindings Removed:
- The
__callmagic insideView.phpthat handled dynamic variable binding has been removed. - You can no longer use
$view->withTitle('foo'). You must use the explicit syntax:$view->with('title', 'foo').
- The
- Decorator & Wrapper Strictness:
- Wrapper classes no longer silently forward missing methods via
__call. - Classes including
Cache\Repository,FilesystemAdapter,ViewErrorBag,SentMessage,Optional,InvokableComponentVariable,AbstractPaginator, andAbstractCursorPaginatorwill now throw aBadMethodCallExceptionif you attempt to call underlying driver methods directly on them. You must now explicitly unwrap them using the->to()method.
- Wrapper classes no longer silently forward missing methods via
- Global
str()Helper Removed:- The dynamic
str()global helper has been completely removed to enforce strict typing. All string manipulations must now useStr::of().
- The dynamic
- Obvious Model Relation Execution:
- Dynamic relation execution via the model's
__callmethod is now disabled and throws an exception. You must use$model->r->relationName()or$model->callSegregatedRelation('relationName').
- Dynamic relation execution via the model's
- Obvious Builder Proxies Removed:
- Magic
__getintercepts fororWhere,whereNot, andorWhereNothave been removed from the Database Builder.
- Magic
✨ New Features & Enhancements
- Explicit Unwrapping (
->to()) on Managers:- Added a strict
->to()method across all core Manager classes (AuthManager,CacheManager,DatabaseManager,LogManager,MailManager,QueueManager,RedisManager,FilesystemManager,BroadcastManager,PasswordBrokerManager,MultipleInstanceManager, andProcess\Factory). - Calling
->to()explicitly returns the underlying active driver/connection, allowing for perfect static analysis. - Note: Manager classes retain their
__callfallback logic to prevent widespread application breakage, but->to()is the recommended standard.
- Added a strict
- Static Unwrapping (
::toStatic()) on Capsules:- Added
::toStatic()toDatabase\Capsule\ManagerandQueue\Capsule\Managerto explicitly retrieve the underlying default connection in static contexts.
- Added
- New Forwarding Trait:
- Introduced
ExplicitForwardabletrait. This trait standardize the new strict architecture by intercepting__callto throw a clearBadMethodCallExceptiondirecting developers to use->to()or::toStatic()instead.
- Introduced