-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
Proxy generation discards callable type-hint #259
Comments
@natelenart this is the right place for such an issue. Can you confirm that following is broken then? class Entity
{
public $id;
public function setFoo(callable $foo) {}
} |
Confirmed with latest dev: https://gist.github.com/natelenart/5110547 |
I'm on it |
There is still an issue. It seems that this bug still present in latest version. |
@nick4fake in common? I solved this issue in |
@Ocramius sorry, that bundle uses own library for generating proxies? Then this is certainly not doctrine issue. |
@nick4fake I don't think that it uses |
As far as I can tell, this is a limitation in PHP itself as there is no
$param->isCallable()
method defined onReflectionParameter
. I'm not sure if there is any way of detectingcallable
s at the moment (short of string parsing/regex), but it would be nice if the docs had a warning about it too (maybe they do and I haven't seen them).Since
callable
is neither a class, nor an array, the generator strips it out, which leads to anErrorException
because the type-hint is not compatible with its parent:In the meantime, I can easily change my code to remove the type-hint and check
is_callable
myself in my method.I hope this is the right place to post this as current stable has the proxy generation code in ORM, but it has been moved to Common in the master branch.
The text was updated successfully, but these errors were encountered: