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

Deprecation messages in symfony 5.4 #809

Closed
jokaorgua opened this issue Nov 30, 2021 · 13 comments
Closed

Deprecation messages in symfony 5.4 #809

jokaorgua opened this issue Nov 30, 2021 · 13 comments

Comments

@jokaorgua
Copy link

Issue description

Deprecation messages when using symfony 5.4

Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.

Method "ArrayAccess::offsetUnset()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.

What version of Imagine are you using?

1.2.4

What's the PHP version you are using?

8.0.13

What's the imaging library you are using [gd/imagick/gmagick/any]?

gd

What's the imaging library configuration

does not matter

Minimal PHP code to reproduce the error:

run any tests

@ausi
Copy link
Collaborator

ausi commented Dec 5, 2021

This problem should already be fixed by #768 because we added #[\ReturnTypeWillChange] attributes there.

@jokaorgua Can you please verify if these deprecation messages are gone in the current dev-develop version?

@jokaorgua
Copy link
Author

@ausi I've tried dev-develop version and deprecation messages still exist

ReturnTypeWillChange was introduced in 8.1 and I'm using 8.0.13. I think that is the problem.

@ausi
Copy link
Collaborator

ausi commented Dec 6, 2021

This might be a bug in Symfony 5.4 then I think. The Symfony ErrorHandler Component should not report a deprecation for the return type if the attribute #[\ReturnTypeWillChange] is present (even in PHP 8.0).

@jokaorgua
Copy link
Author

@ausi I can not find a code in ErrorHandler component which should react to ReturnTypeWillChange

could you provide a link where it is said that Symfony 5.4 on PHP prior to 8.1 must not trigger a deprecation message?

@ausi
Copy link
Collaborator

ausi commented Dec 6, 2021

could you provide a link where it is said that Symfony 5.4 on PHP prior to 8.1 must not trigger a deprecation message?

This is just my opinion, but I think Symfony might agree that a deprecation does not make sense in this case.

That code where the attributes schould be handled is somewhere aroud here I think: https://github.com/symfony/symfony/blob/dcf09d6c0a194f5f36ec963eb6fef92d573db576/src/Symfony/Component/ErrorHandler/DebugClassLoader.php#L563

ruudk added a commit to ruudk/Imagine that referenced this issue Jan 4, 2022
Fixes the following deprecations reported by Symfony:
```
Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetExists()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetSet()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetUnset()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
```

References:
- php-imagine#809
@ruudk
Copy link
Contributor

ruudk commented Jan 4, 2022

I created a PR to add the missing types.

@ausi
Copy link
Collaborator

ausi commented Jan 5, 2022

I didn’t notice that adding the return types via PHPDoc (in contrast to real return types) also fixes the issue, so your PR is correct IMO. Thank you!

@jokaorgua
Copy link
Author

@ausi symfony thinks that [#\ReturnTypeWillChange] is not enough and phpdoc must be added

symfony/symfony#44929

ruudk added a commit to ruudk/Imagine that referenced this issue Jan 6, 2022
Fixes the following deprecations reported by Symfony:
```
Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetExists()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetSet()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetUnset()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
```

References:
- php-imagine#809
@ausi
Copy link
Collaborator

ausi commented Jan 6, 2022

symfony thinks that [#\ReturnTypeWillChange] is not enough and phpdoc must be added

Makes sense! 👍

@jokaorgua
Copy link
Author

@ausi will this be merged into master and new release created?

@mlocati
Copy link
Collaborator

mlocati commented Jan 18, 2022

We'd first fix these issues: https://github.com/php-imagine/Imagine/milestone/1

@ausi
Copy link
Collaborator

ausi commented Jan 18, 2022

@jokaorgua I assume so, see #814

Regarding release, see #768 (comment)

mlocati pushed a commit to mlocati-forks/Imagine that referenced this issue Mar 15, 2022
Fixes the following deprecations reported by Symfony:
```
Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetExists()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetSet()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetUnset()" might add "void" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Imagine\Image\Metadata\MetadataBag" now to avoid errors or add an explicit @return annotation to suppress this message.
```

References:
- php-imagine#809
@mlocati
Copy link
Collaborator

mlocati commented Mar 15, 2022

Fixed.

@mlocati mlocati closed this as completed Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants