php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.42k stars 530 forks source link

Fix deprecations in MetadataBag #819

Closed xkzl closed 2 years ago

xkzl commented 2 years ago
mlocati commented 2 years ago

Isn't #[\ReturnTypeWillChange] enough?

xkzl commented 2 years ago

I get dozen of warnings right now with using PHP 8.1.

In my understanding, MetadataBag is not the player in charge of the return type, but "ArrayAccess". So it should just be updated accordingly. Unless I missed something.

mlocati commented 2 years ago

I get dozen of warnings right now with using PHP 8.1.

Do you have the #[\ReturnTypeWillChange] attribute in your code?

ausi commented 2 years ago

I get dozen of warnings right now with using PHP 8.1.

I was not able to reproduce that. Are you using the dev-develop version or 1.2.4?

mbabker commented 2 years ago

You need a combination of #[\ReturnTypeWillChange] to silence the PHP engine deprecations and a @return annotation to silence the deprecations coming from Symfony's debug class loader.

Adding the native return types is a B/C break in an open class, and as is breaks PHP 7 support with the mixed type.

Edit: #814 is actually the right fix for Imagine's current operating environment.