Fix mock generated method signature with callable type hint #210
Conversation
Please add the unit test. |
Done. |
I think that your test failed with PHP 5.3 because |
Yes. That's why I added a |
Oh sorry, i have don't see the annotation in the test (note for later: do not review PR at midnight ;)). |
classes/mock/generator.php
Outdated
@@ -409,6 +409,10 @@ protected static function getParameterType(\reflectionParameter $parameter) | |||
{ | |||
$type = 'array '; | |||
} | |||
elseif (method_exists($parameter, 'isCallable') && $parameter->isCallable() == true) |
mageekguy
Apr 30, 2013
Contributor
Please use switch(true) { case $parameter->isArray(): …
instead of if… else if … else
.
Please use switch(true) { case $parameter->isArray(): …
instead of if… else if … else
.
adriensamson
May 2, 2013
Author
Contributor
Fixed
Fixed
mageekguy
added a commit
that referenced
this pull request
May 6, 2013
Add callable type hint management, thanks to @adriensamson.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
This PR fixes the generated mock class when one of its methods has a 'callable' type hint.