dg / bypass-finals

Removes `final` and `readonly` keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit or Mockery.
Other
477 stars 30 forks source link

Class with __invoke cannot be mocked #22

Closed sergejostir closed 4 years ago

sergejostir commented 4 years ago

Hello.

I ran across a problem when I use a class that only has a __invoke method. It complains that such class is marked final and cannot be mocked. If I use a normal method then the problem disappears.

Is there something I can do about that?

dg commented 4 years ago

I can't simulate such a situation. When I change the method name to __invoke in this test, it still works fine. https://github.com/dg/bypass-finals/blob/master/tests/BypassFinals/fixtures/final.class.php#L8

sergejostir commented 3 years ago

I can confirm that it is indeed working. Not sure why the problem occured back then.