-
-
Notifications
You must be signed in to change notification settings - Fork 640
Closed
Description
Feature request
Many frameworks provide ways of dynamically loading props & methods into a class at runtime (essentially a runtime trait).
E.g., Yii Behaviors: https://www.yiiframework.com/doc/guide/2.0/en/concept-behaviors
This becomes inherently difficult for any static tooling (eg IDEs, PHPStan) to know about these additional class members.
Normally this means you need to create stubs.
@mixin isn't an option, as the classes we're referring to are libraries/Composer packages.
My proposal is to support something like @mixin-to \some\ns\SomeClass that could be added to either classes or class members to add those members to the referenced entity.
Reactions are currently unavailable