Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Proposal: @mixin-to (specify @mixin from child) #3314

@timkelty

Description

@timkelty

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions