| 1 | <?php | ||
| 20 | class SuperClosureTest extends \PHPUnit_Framework_TestCase | ||
| 21 | { | ||
| 22 | /** | ||
| 23 | * @var SerializerInterface | ||
| 24 | */ | ||
| 25 | public $serializer; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * @var \PHPUnit_Framework_MockObject_MockObject|\SuperClosure\Serializer | ||
| 29 | */ | ||
| 30 | public $superClosure; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * | ||
| 34 | */ | ||
| 35 | public function setUp() | ||
| 40 | |||
| 41 | /** | ||
| 42 | * | ||
| 43 | */ | ||
| 44 | public function testSerializeCalled() | ||
| 58 | |||
| 59 | /** | ||
| 60 | * | ||
| 61 | */ | ||
| 62 | public function testSerializeNonClosure() | ||
| 68 | |||
| 69 | /** | ||
| 70 | * | ||
| 71 | */ | ||
| 72 | public function testUnserializeCalled() | ||
| 80 | } | ||
| 81 | 
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: