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

Support for laminas-hydrator v4 #56

Closed
michalbundyra opened this issue Jan 28, 2020 · 3 comments
Closed

Support for laminas-hydrator v4 #56

michalbundyra opened this issue Jan 28, 2020 · 3 comments
Milestone

Comments

@michalbundyra
Copy link
Member

Bug Report

Q A
Version(s) 2.14.3

Summary

There is a problem with compatibility with laminas-hydrator v3 in Laminas\Form class:
https://github.com/laminas/laminas-form/blob/master/src/Form.php#L315

We can't extend it and implement Laminas\Hydrator\HydratorAwareInterface.

Current behavior

When we do that we are getting the following exception:

Fatal error: Declaration of Laminas\Form\Form::setHydrator(Laminas\Hydrator\HydratorInterface $hydrator) must be compatible with Laminas\Hydrator\HydratorAwareInterface::setHydrator(Laminas\Hydrator\HydratorInterface $hydrator): void in ...

How to reproduce

class MyForm extend Form implements HydratorAwareInterface {
}

Expected behavior

It is possible to extend Form and implement interface HydratorAwareInterface.

@michalbundyra michalbundyra added BC Break Bug Something isn't working labels Jan 28, 2020
@boesing boesing changed the title Support for laminas-hydrator v3 Support for laminas-hydrator v4 Dec 23, 2020
@boesing
Copy link
Member

boesing commented Dec 23, 2020

I'll change this as v3 is already supported.
V4 is not. As we already support v3, we could provide v4 without breaking the API probably.

@boesing boesing added Enhancement and removed BC Break Bug Something isn't working labels Dec 23, 2020
@driehle
Copy link
Contributor

driehle commented Jan 13, 2021

@boesing The issue mentioned by @michalbundyra cannot be solved without dropping support for PHP <= 7.0, since you will have to add the return type void to Laminas\Form\Form::setHydrator(). Since 2.15.x still supports PHP 5.6 this cannot happen there, but with merging #75 (PHP 8.0) this should likely work for 2.16.x.

However, adding support for laminas/laminas-hydrator:^4.0 is independant from that. The 4.0 series comes with (only) one BC break, see https://github.com/laminas/laminas-hydrator/releases, which is an optional parameter ?object $instance = null in the Laminas\Hydrator\Filter\FilterInterface::filter() function. Since this package does not define any filters, I am curious if that update will affect this package at all. I guess you could add support for ^4.0 to an 2.15.1 release easily. Let me know if I should provide a PR for this.

@driehle
Copy link
Contributor

driehle commented May 17, 2021

@boesing @michalbundyra This has already been implemented with #75 and released in 2.16.0. I guess this issue should be closed.

@michalbundyra michalbundyra added this to the 2.16.0 milestone May 17, 2021
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

3 participants