phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

Fix the class attached to methodnotfoundexception #514

Closed ciaranmcnulty closed 3 years ago

ciaranmcnulty commented 3 years ago

The class was always being set to ObjectProphecy, which causes issues when trying to work out which class the method was not found on

An alternative would have been to use $this->getProphecy()->reveal() but that may cause side effects

Fixing this resolves https://github.com/phpspec/phpspec/issues/1350

stof commented 3 years ago

this now passes a string rather than an object. Is it expected ?

ciaranmcnulty commented 3 years ago

@stof the exception's constructor parameter is object|string and the accessor is called getClassname with no return type. There is one other place this is thrown and it's already being thrown as a string, so hopefully consumers expect it.