Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProxyTrait::stub() actually return $this. #45

Open
Giuffre opened this issue Feb 6, 2018 · 1 comment
Open

ProxyTrait::stub() actually return $this. #45

Giuffre opened this issue Feb 6, 2018 · 1 comment
Assignees

Comments

@Giuffre
Copy link
Contributor

Giuffre commented Feb 6, 2018

Is not a good design if we want to compose functionality for Proxies (ProxyInterface) because we can't warranted the return type.

Refactor of this part or include this method in an abstract proxy.

    /**
     * @param array $namesWithValues
     * @return ProxyInterface
     *
     * @throws InvalidArgumentException
     * @throws MockNotCreatedException
     */
    public function stub(array $namesWithValues): ProxyInterface
    {
        //...

        /** @var $this ProxyInterface */
        $this->__moka_mockingStrategy->decorate($this->__moka_mock, $namesWithValues);

        return $this;
    }
@Giuffre Giuffre self-assigned this Feb 6, 2018
@xzhayon
Copy link
Member

xzhayon commented Feb 13, 2018

I'm afraid an abstract cannot be used, as it would have to extend the generated mock class. That's why we opted for the trait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants