GithubHelp home page GithubHelp logo

Comments (9)

derrabus avatar derrabus commented on June 3, 2024 1

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 readonlyclasses already. Maybe taking back that change is acceptable if we are quick. 😕

from phpunit.

sebastianbergmann avatar sebastianbergmann commented on June 3, 2024 1

PHPUnit 11.0.1 has been released with this fix.

from phpunit.

stof avatar stof commented on June 3, 2024

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.

sebastianbergmann avatar sebastianbergmann commented on June 3, 2024

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.

stof avatar stof commented on June 3, 2024

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.

stof avatar stof commented on June 3, 2024

Thanks for the decision to revert it. It will make things a lot easier.

from phpunit.

stof avatar stof commented on June 3, 2024

@sebastianbergmann what about the changelog amending for other non-internal non-final classes that were turned readonly ?

from phpunit.

sebastianbergmann avatar sebastianbergmann commented on June 3, 2024

@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.

derrabus avatar derrabus commented on June 3, 2024

Thank you very much, @sebastianbergmann!

from phpunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.