phpspec / prophecy

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

return type not compatible anymore #503

Closed maddy2101 closed 4 years ago

maddy2101 commented 4 years ago

With https://github.com/phpspec/prophecy/commit/f8add3131ec60d8fce8308f2431c4d29b60890cf#diff-4c5e3d292394f5c16c0cd7597bc2dd87 return type handling was changed, and it causes a failure for me. This is the situation:

$mailTransport = $this->prophesize(\Symfony\Component\Mailer\Transport\SendmailTransport::class);

=> PHP Fatal error: Declaration of Double\Symfony\Component\Mailer\Transport\SendmailTransport\P144::setMaxPerSecond(float $rate): Symfony\Component\Mailer\Transport\SendmailTransport must be compatible with Symfony\Component\Mailer\Transport\AbstractTransport::setMaxPerSecond(float $rate): Symfony\Component\Mailer\Transport\AbstractTransport in /srv/bamboo/xml-data/build-dir/CORE-GTN-UTR1PHP721/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code on line 2

and this is the explanation: Symfony\Component\Mailer\Transport\AbstractTransport::setMaxPerSecond() defines a return type of self, while prophecy interprets a return type of \Symfony\Component\Mailer\Transport\SendmailTransport

This then fails the eval test. The error is present with the new tag of 1.12.0, but not with 1.11.1.

ciaranmcnulty commented 4 years ago

If this is a dupe I'll keep #502 open and close this one - thanks for reporting

ciaranmcnulty commented 4 years ago

Sorry #502 is a PR so this should be open.

Thanks for the specific git hash - that's very helpful

ciaranmcnulty commented 4 years ago

If you are able to test #504 that would be great

maddy2101 commented 4 years ago

Testing in progress.

Thank you very much for this really fast merge and tag. This way we can run our nightly test again, it will tell exactly whether the issue is resolved. I am impressed, very good work, keep it up :+1: :)

Kind regards Anja

maddy2101 commented 4 years ago

verified, the failure is gone. Thank you ever so much for that very quick handling.