padraic/mockery — Issue #47: Scalar type-hints on partial mocks throws exception
Author: RobMasters
Created: 2012-01-26 14:31:34+00:00
State: open

It took me a little while to figure out why I was getting the following error when creating a partial mock of a non-abstract class:

ReflectionException: Class bool does not exist
#0 /path/to/Mockery/Generator.php(239): ReflectionParameter->getClass()
#1 /path/to/Mockery/Generator.php(209): Mockery\Generator::_renderPublicMethodParameters(Object(ReflectionMethod))

It turns out this was being caused by the following method declaration, which, for some reason, is valid despite being completely pointless:

public function setHaltOnFailure( bool $haltOnFailure )

I'm not sure if this issue applies to anything other than partial mocks as I haven't come across any yet.