Closed greg0ire closed 4 years ago
@Ayesh can you please take a look?
I hope it's OK to CC @stof, and hopefully @GrahamCampbell. They both recently worked on many PHP 8 upgrade changes, so hopefully we can get their valuable feedback as well.
My primary guess is that ClassMirror::getParameterClassName
is not accommodating self
well. Thanks for providing a failing test (#485), I will take a look now.
I just came to the same conclusion 👍, see my fourth checkbox
@Ayesh I think I found a fix, will amend #485
@Ayesh done, please review.
We've experienced same issue in Sylius. Thanks for your contribution 👍
Observed this twice with 2 different classes already while working on https://github.com/sonata-project/SonataAdminBundle/pull/6186 :
Fatal error: Declaration of Double\ItemInterface\P22::setParent(?Double\ItemInterface\P22 $parent = NULL): Knp\Menu\ItemInterface must be compatible with Knp\Menu\ItemInterface::setParent(?Knp\Menu\ItemInterface $parent = NULL): Knp\Menu\ItemInterface in /home/greg/dev/SonataAdminBundle/vendor/bin/.phpunit/phpunit-8.5.0-0/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49)
Fatal error: Declaration of Double\FormInterface\P30::setParent(?Double\FormInterface\P30 $parent = NULL) must be compatible with Symfony\Component\Form\FormInterface::setParent(?Symfony\Component\Form\FormInterface $parent = NULL) in /home/greg/dev/SonataAdminBundle/vendor/bin/.phpunit/phpunit-8.5.0-0/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49)
In both cases, the interface references itself in the signature.
Possible next steps:
use Prophecy\Prophet;
require 'vendor/autoload.php';
interface SelfReferencing { public function __invoke(self $self); }
$selfReferencing = (new Prophet)->prophesize(SelfReferencing::class); $selfReferencing->reveal();