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

Fix mock generated method signature with callable type hint #210

Merged
merged 5 commits into from May 6, 2013

Conversation

@adriensamson
Copy link
Contributor

@adriensamson adriensamson commented Apr 29, 2013

This PR fixes the generated mock class when one of its methods has a 'callable' type hint.

@mageekguy
Copy link
Contributor

@mageekguy mageekguy commented Apr 29, 2013

Please add the unit test.

Adrien SAMSON added 3 commits Apr 29, 2013
@adriensamson
Copy link
Contributor Author

@adriensamson adriensamson commented Apr 29, 2013

Done.

@mageekguy
Copy link
Contributor

@mageekguy mageekguy commented Apr 29, 2013

I think that your test failed with PHP 5.3 because reflectionMethod::isCallable() does not exist with this version.

@adriensamson
Copy link
Contributor Author

@adriensamson adriensamson commented Apr 30, 2013

Yes. That's why I added a method_exists call in the generator and skipped the test for 5.3

@mageekguy
Copy link
Contributor

@mageekguy mageekguy commented Apr 30, 2013

Oh sorry, i have don't see the annotation in the test (note for later: do not review PR at midnight ;)).

@@ -409,6 +409,10 @@ protected static function getParameterType(\reflectionParameter $parameter)
{
$type = 'array ';
}
elseif (method_exists($parameter, 'isCallable') && $parameter->isCallable() == true)

This comment has been minimized.

@mageekguy

mageekguy Apr 30, 2013
Contributor

Please use switch(true) { case $parameter->isArray(): … instead of if… else if … else.

This comment has been minimized.

@adriensamson

adriensamson May 2, 2013
Author Contributor

Fixed

Adrien SAMSON
mageekguy added a commit that referenced this pull request May 6, 2013
Add callable type hint management, thanks to @adriensamson.
@mageekguy mageekguy merged commit 0ef1ea9 into atoum:master May 6, 2013
1 check passed
1 check passed
default The Travis build passed
Details
@adriensamson adriensamson deleted the adriensamson:fix-mock-callable branch May 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants