Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Enable usage of parameter type widening for proxies #380

Closed
lisachenko opened this issue Dec 25, 2017 · 1 comment
Closed

[Feature] Enable usage of parameter type widening for proxies #380

lisachenko opened this issue Dec 25, 2017 · 1 comment
Labels
Milestone

Comments

@lisachenko
Copy link
Member

Framework engine could use PHP7.2 feature for parameter type widening in generated proxies. This feature is described here: https://wiki.php.net/rfc/parameter-no-type-variance

When feature is enabled, then we can weak arguments for original methods and implement different advices that will be able to handle such arguments like ParamConverter from the Symfony.

Possible usage: automatic injection of value for tests, handling custom proxies, etc...

@lisachenko lisachenko added this to the 3.0.0 milestone Dec 25, 2017
@TheCelavi
Copy link
Contributor

Since we are using inheritance, we are unable to remove parameters from method signature - I am for that option (unfortunately, it is impossible to do it like in example below):

class A_AopProxied 
{
    public method foo(ParamType $value, ParamOtherType $value2...) 
    {
    }
}

class A extends A_AopProxied 
{
    public method foo()
    {
           // invoke parent method with func_get_args
    }
}

Generating proxy methods in such way would allow us to use GoAOP for implementing adapter pattern, useful with vendor libraries....

However, this:

class A extends A_AopProxied 
{
    public method foo($value, $value2...)
    {
           // invoke parent method with func_get_args
    }
}

is next best thing. So, yeah - this will be useful and powerful tool as well.

lisachenko added a commit that referenced this issue Jan 8, 2018
[Feature] Implement parameter widening feature for generated code (#380)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants