You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to PHP 8.2 and making a number of classes readonly, our tests began failing. We use a lot of dependency injection so in those cases we need to mock the injected classes. I get the following error:
In EvalLoader.php(34) : eval()'d code line 30:
Non-readonly class Mockery_7_ClassToBeMocked cannot extend readonly class ClassToBeMocked
If I remove readonly from the class and instead make the properties readonly, it works, so currently we are using this approach as a workaround, but I would like to know if Mockery is planning to add support to readonly classes in the future.
Steps to Reproduce
Create a mock of a readonly class using Mockery.
Expected Behavior
The mock is successfully created.
Actual Behavior
An exception is thrown.
Exception or Error
In EvalLoader.php(34) : eval()'d code line 30:
Non-readonly class Mockery_7_ClassToBeMocked cannot extend readonly class ClassToBeMocked
Additional Information
No response
The text was updated successfully, but these errors were encountered:
I wanted to give some updates, but I don't have the full resolution yet.
Working on a fix for this in #1319 but it is not that simple (and may not be possible because of readonly class restrictions) so I need a little more time to address this issue.
I really appreciate your patience as we work through this issue together, thank you.
Mockery Version
1.5.1
PHP Version
PHP 8.2
Issue Description
After upgrading to PHP 8.2 and making a number of classes readonly, our tests began failing. We use a lot of dependency injection so in those cases we need to mock the injected classes. I get the following error:
If I remove readonly from the class and instead make the properties readonly, it works, so currently we are using this approach as a workaround, but I would like to know if Mockery is planning to add support to readonly classes in the future.
Steps to Reproduce
Create a mock of a readonly class using Mockery.
Expected Behavior
The mock is successfully created.
Actual Behavior
An exception is thrown.
Exception or Error
Additional Information
No response
The text was updated successfully, but these errors were encountered: