GithubHelp home page GithubHelp logo

Comments (4)

pimjansen avatar pimjansen commented on August 22, 2024 1

I was not aware of those reflection methods tbh. Will review those usecases. Thanks for the swift response!

from doctrinemodule.

driehle avatar driehle commented on August 22, 2024

Could you please elaborate which class implementation has changed (i.e. please name the fully qualified name of that class) between 4.1 and 4.2 from your point of view?

from doctrinemodule.

pimjansen avatar pimjansen commented on August 22, 2024

The image shows it best i guess. the ObjectSelect has been renamed to a Polyfill. Same goes for the other select types i can see in the PR itself.

image

from doctrinemodule.

driehle avatar driehle commented on August 22, 2024

Well, you need to look at the whole PR. Though you mentioned the polyfills in your initial issue description, I am not sure if you are aware how polyfills actually work. Please have a look the the following change from the same PR:

screenshot

First, the file autoload/polyfill-form-elements.php is included in the autoload section of composer.json. Therefore, this file will always be loaded without any conditions.

Second, the file checks which version of laminas/laminas-form the user has installed. That is the part with null === $reflectionMethod->getReturnType(). It will be true for 2.x and false for 3.x. You can look into a diff of laminas-form 2.x and 3.x to validate that this is actually the case.

Third, the class DoctrineModule\Form\Element\ObjectMultiCheckboxV2Polyfill is pushed into the right place when laminas-form 2.x is installed using class_alias(), i.e. it is aliased to DoctrineModule\Form\Element\ObjectMultiCheckbox. And that is exactly the name it had in earlier versions. Please read the PHP documentation on class_alias: https://www.php.net/manual/en/function.class-alias.php. This function creates an exact copy of the class, i.e. defining the class as ObjectMultiCheckboxV2Polyfill and aliasing it to ObjectMultiCheckbox is absolutely identical to defining it directly as ObjectMultiCheckbox!

So as DoctrineModule 4.1.x and 4.2.0 both provide DoctrineModule\Form\Element\ObjectMultiCheckbox with the very same signatures, there is no BC break in DoctrineModule 4.2.0.


There is only one case where an update from DoctrineModule 4.1.x to 4.2.0 can cause troubles: If you in your application use laminas-form and you do not have specified laminas-form in your composer.json, upgrading DoctrineModule to 4.2.0 will upgrade laminas-form from 2.x to 3.x in your application. And that will obviously result in issues, as laminas-form 3.x has BC breaks (that is why it is a new major version).

If that is the case I strongly recommend using a tool like compoer-require-checker which checks if you have so-called soft dependencies in your application.

Lastly, you refer to using polyfills as "kinda risky". I disagree with that statement. In laminas-form, which back then was still called zendframework/zend-form, the same principle was applied in 2.15.x. 2.14.x only supported servicemanager 2.x, 2.15.x supported servicemanager 2.x and 3.x through polyfills. They event went a step further, in 2.16.x they removed support for servicemanager 2.x. Considering that laminas-form (counting both laminas-form and zend-form) has over 16 million installs, I don not think that using polyfills is a risky behaviour.

from doctrinemodule.

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.