Closed pardeep26k closed 3 years ago
Thanks for the report, it looks like the double's type hint is array|\false
where the \false
is what's in error
From what I remember it's ReturnTypeNode that would be responsible for knowing which types (classes) need a prefixed \
https://github.com/phpspec/prophecy/blob/3f22964cebf655ce6da5acc066ce3a1c7666f279/src/Prophecy/Doubler/Generator/Node/TypeNodeAbstract.php#L45 needs to be updated to account for false
on newer PHP versions
needs to be updated to account for
false
on newer PHP versions
@stof Any plan to work on this fix?
There's some other behaviour we need to account for too (i.e. false can only be part of a union)
There's some other behaviour we need to account for too (i.e. false can only be part of a union)
@ciaranmcnulty Any idea we merge and release that change?
No ETA, please use a fork if it's blocking you
Here are the issue details. If I try to mock this interface method it will fail with the below error in PHP 8.0.2 >
PHP Fatal error: Type declaration 'false' must be unqualified in /app/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code on line 5
Discovery
We are currently upgrading PHP to version 8 and our unit test fails with the error described above.
I think the main reason is multiple methods has return type like this
false is a keyword, not a global name so it cannot have \