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

phpunit 11 incompatibility with symfony WebTestCase #53731

Closed
mmarton opened this issue Feb 2, 2024 · 9 comments
Closed

phpunit 11 incompatibility with symfony WebTestCase #53731

mmarton opened this issue Feb 2, 2024 · 9 comments

Comments

@mmarton
Copy link

mmarton commented Feb 2, 2024

Symfony version(s) affected

6.4.*

Description

Just tried out the new phpunit 11 and got the followiong fatal error:

Fatal error: Non-readonly class Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsSuccessful cannot extend readonly class PHPUnit\Framework\Constraint\Constraint

How to reproduce

  1. install phpunit11 in your project,
  2. create a testcase extending WebTestCase
  3. run test

Possible Solution

No response

Additional Context

No response

@derrabus
Copy link
Member

derrabus commented Feb 2, 2024

Which PHP version is this?

@mmarton
Copy link
Author

mmarton commented Feb 2, 2024

PHP 8.2.15 (cli) (built: Jan 19 2024 23:39:18) (NTS)

@derrabus
Copy link
Member

derrabus commented Feb 2, 2024

Do you have the possibility to try this on PHP 8.3?

edit: Nevermind, that shouldn't make a difference. 😞

@stof
Copy link
Member

stof commented Feb 2, 2024

@sebastianbergmann turning classes as readonly class is a BC break that will make it impossible to support 2 versions of PHPunit easily, as it will require conditional class declarations for all custom constraints.

@derrabus
Copy link
Member

derrabus commented Feb 2, 2024

I thought, PHP 8.3 would allow non-readonly classes to extend readonly ones, but that proposal was rejected apparently: https://wiki.php.net/rfc/readonly_amendments

@mmarton
Copy link
Author

mmarton commented Feb 2, 2024

Tried it with PHP 8.3.2 (cli) (built: Feb 1 2024 02:00:33) (NTS)
result is the same

@stof
Copy link
Member

stof commented Feb 2, 2024

As said, the RFC has been rejected, so this is not surprising.

I reported the undocumented BC break to phpunit. Let's see how phpunit handles it.

@sebastianbergmann
Copy link
Contributor

I handled it, thank you for bringing this to my attention.

@mmarton
Copy link
Author

mmarton commented Feb 2, 2024

closing as fixed. Thank you @sebastianbergmann

@mmarton mmarton closed this as completed Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants