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

Calling PHPStan\Mockery\Type\Expects::with() is not covered by backward compatibility promise. #33

Closed
ruudk opened this issue Jun 10, 2021 · 6 comments

Comments

@ruudk
Copy link
Contributor

ruudk commented Jun 10, 2021

When upgrading from phpstan/phpstan 0.12.88 to 0.12.89 I'm getting a lot of errors like this:

Calling PHPStan\Mockery\Type\Expects::with() is not covered by backward compatibility promise. The
         method might change in a minor PHPStan version.
         💡 If you think it should be covered by backward compatibility promise, open a discussion:
            https://github.com/phpstan/phpstan/discussions

            See also:
            https://phpstan.org/developing-extensions/backward-compatibility-promise

I see that a fix has been pushed for phpstan-phpunit. Should the same type of fix be done here as well?

@ondrejmirtes
Copy link
Member

Please post a piece of code that reproduces this problem. I'm not aware of anything in phpstan-phpunit that would be causing a similar problem.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 10, 2021

I'm sorry for not being clear. I saw a commit on phpstan-phpunit that speaks about backwards compatibility, similar to the error I'm getting: phpstan/phpstan-phpunit@151d71b

This is my code:

/**
 * @var MockInterface&DraftRepository
 */
private MockInterface $draftRepository;

// ...

$this->draftRepository->expects('getActiveByUser')
    ->with($user)
    ->andReturn(new Draft());

@ondrejmirtes
Copy link
Member

In PHPUnit it was about something else - fixing a situation where PHPStan-specific code was marked as an error because it used something not covered by BC promise - a legit issue.

In this case PHPStan is reporting normal analyzed code like that, which it shouldn't. I'm gonna look into it.

@ondrejmirtes
Copy link
Member

I think I fixed it: 7cc74bf

Please try phpstan-mockery 0.12.14 to see if it works.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 14, 2021

Seems to be solved. Thanks @ondrejmirtes 💙

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants