eloquent / phony

Mocks, stubs, and spies for PHP.
http://eloquent-software.com/phony
MIT License
194 stars 7 forks source link

Fatal error when attempting to mock a trait that uses the `self` type #268

Closed ezzatron closed 1 year ago

ezzatron commented 1 year ago

See #253 for context.

Example of a trait that cannot be mocked currently. Not sure if abstract is necessary or not, suspect not:

trait TestTraitWithAbstractSelfMethod
{
    abstract public static function staticMethod(): self;

    abstract public function method(): self;
}

Phony is probably eagerly resolving self into TestTraitWithAbstractSelfMethod, which obviously doesn't make sense.