Comments (9)
FTR, the corresponding commit was d82f5ad. I didn't find any discussion around this change though.
As @stof said, this change is a huge pain for 3rd party PHPUnit extensions that maintain compatibility for multiple PHPUnit versions. It would be really helpful if we could remove the readonly
flag from classes that are meant to be extended downstream and have existed in PHPUnit 10 already.
Then again, removing the readonly
flag from abstract classes like Constraint
is a BC break as well. Not sure, how many projects have migrated their constraints to the new readonly
classes already. Maybe taking back that change is acceptable if we are quick. 😕
from phpunit.
PHPUnit 11.0.1 has been released with this fix.
from phpunit.
As the change has been rejected in https://wiki.php.net/rfc/readonly_amendments, this readonly
flag at the class level effectively splits the classes into 2 incompatible sets as far as inheritance is concerned.
Adding it or removing it on non-final classes is a BC break.
from phpunit.
This is a BC break for all child class (i.e. all custom constraints) because PHP requires that child classes have the same readonly flag than their parent (so either both readonly or none).
This is a BC break, but it was done in a major version, so I expected this to be fine.
Do you really expect me to revert this change or is amending the ChangeLog to cover this change enough?
Nevermind, I'll revert this change and release PHPUnit 11.0.1 in a bit.
from phpunit.
Well, this makes it a huge pain for projects providing custom constraints. It would be great to be able to support the 2 major versions of PHPUnit at the same time (for a package that is dedicated to PHPUnit constraint, making a new major version
so I expected this to be fine
doing BC breaks in major version is indeed OK regarding semver. But to me, the fact that it was not announced (while being the most painful BC break of the release) is not. If this was known to be a BC break when doing it, it should have been announced..
Note that the commit included similar changes for some other non-final classes (TestData, TestSuite, etc...). As those are less common in third party code, it might be OK to keep them readonly in 11.x but I would still expect the changelog to be amended for them.
from phpunit.
Thanks for the decision to revert it. It will make things a lot easier.
from phpunit.
@sebastianbergmann what about the changelog amending for other non-internal non-final classes that were turned readonly ?
from phpunit.
@sebastianbergmann what about the changelog amending for other non-internal non-final classes that were turned readonly ?
As far as I can see, this only affects value objects that are passed from PHPUnit's event system to subscribers. Please see the section titled "Event System: Value Objects" that I just added to https://phpunit.de/backward-compatibility.html.
from phpunit.
Thank you very much, @sebastianbergmann!
from phpunit.
Related Issues (20)
- Run code coverage without a phpunit.xml HOT 6
- [Question] returnCallback + willReturnOnConsecutiveCalls HOT 2
- Avoid abstract test warning HOT 3
- Too few arguments to function PHPUnit\Framework\TestCase::__construct(), 0 passed HOT 5
- Depends attribute and annotation only skip tests, but don't execute them on success HOT 2
- Test with dependencies and data provider fails HOT 3
- Testing a method in a Custom Extension class HOT 5
- Is it possible to remove final declaration HOT 2
- [DX] Massive deprecations when upgrading to 10.5.18 and 10.5.20 HOT 4
- Arbitrary annotations attached to test cases. HOT 2
- advice on installing phpunit HOT 1
- Unknown option "--ansi" HOT 1
- Allow attributes for code coverage targeting to also be used on the test method level (instead of only on the test class level) HOT 4
- Allow enabling process isolation on suite/test base class HOT 1
- Include deprecation/warning failures in JUnit logs
- Multiple dataProviders testCases with same key (name) are not detected HOT 1
- Allow selected deprecations to be skipped/ignored HOT 1
- Run garbage collector on AfterLastTestMethodFinished HOT 1
- Fatal with some error/exception handlers HOT 2
- Issue5592Test fails when registering an error handler in an auto_prepend_file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpunit.