php Mockery throwing unexpected "must implement interface" exception when function method is typehinted

StackOverflow https://stackoverflow.com/questions/22104314

  •  18-10-2022
  •  | 
  •  

Question

I'm using Mockery to unit test an admittedly edge case. It's failing and I don't think it should fail, so there could be a bug within Mockery.

Consider an object that has a method. The method has an argument signature where the first argument is typehinted and defaults to null. The second argument does not have a default.

When the method is called on the object with null as first argument, it works fine. When the method is called on a Mocked object with null as the first argument, it fails.

Please see sample code here: https://gist.github.com/awei01/9278119

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top