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

PHP Fatal Error: With PHPunit 10 and above getting a php fatal error of overriding final methods #1155

Open
apathak18 opened this issue Mar 12, 2024 · 1 comment

Comments

@apathak18
Copy link

apathak18 commented Mar 12, 2024

Steps to reproduce

include OutputAwareTrait or IO in your phpunit test case which extends PHPUnit\Framework\TestCase
On running that particular will throw a php fatal error:
PHP Fatal error: Cannot override final method PHPUnit\Framework\TestCase::output() in /Project-Dir/vendor/consolidation/robo/src/Common/OutputAwareTrait.php on line 33

Expected behavior

Phpunit will run without php fatal error.

Actual behavior

PHP Fatal error: Cannot override final method PHPUnit\Framework\TestCase::output() in /Project-Dir/vendor/consolidation/robo/src/Common/OutputAwareTrait.php on line 33

System Configuration

PHP version: 8.2
PHPunit: 10.5.12

@greg-1-anderson
Copy link
Member

This incompatibility is unfortunate, but as a workaround, you could clone OutputAwareTrait and make your own version in your own namespace, since this is just a utility trait.

Fixing this would break backwards compatibility, and therefore could not happen until Robo 5. I am unlikely to create a new major version just for this, and currently there is no scheduled timeframe for a new major version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants