Please see https://github.com/larastan/larastan/issues/2034 for some context. Essentially this idea of a "decorated" mixin (where the original called on type is returned instead of the return type from the mixin method) is fairly common---it would be nice to have support for this without having to create a custom DynamicReturnTypeExtension / ClassReflectionExtension. Maybe something like:
@decorated Class
@mixin-decorated Class
??
Note that the Laravel framework also has the same idea of a "decorated" forwarded call where the called on type is returned if the mixin object returns itself (otherwise it returns the method return type).
Thanks!
Did PHPStan help you today? Did it make you happy in any way?
Yes! This gives me confidence that my code is safe to ship :)
Feature request
Hello!
Please see https://github.com/larastan/larastan/issues/2034 for some context. Essentially this idea of a "decorated" mixin (where the original called on type is returned instead of the return type from the mixin method) is fairly common---it would be nice to have support for this without having to create a custom DynamicReturnTypeExtension / ClassReflectionExtension. Maybe something like:
@decorated Class
@mixin-decorated Class
Note that the Laravel framework also has the same idea of a "decorated" forwarded call where the called on type is returned if the mixin object returns itself (otherwise it returns the method return type).
Thanks!
Did PHPStan help you today? Did it make you happy in any way?
Yes! This gives me confidence that my code is safe to ship :)