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 message is produced even with [#\ReturnTypeWillChange] #44929

Closed
jokaorgua opened this issue Jan 6, 2022 · 1 comment
Closed

Comments

@jokaorgua
Copy link

Symfony version(s) affected

5.4.2

Description

If the class implements \Countable interface and method "count" has no return type we have a deprecation notice even with [#\ReturnTypeWillChange] attribute

Implementation example which causes the deprecation message is here https://github.com/aws/aws-sdk-php/blob/master/src/HandlerList.php#L308 (official AWS SDK for PHP)

the deprecation message

Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Aws\HandlerList" now to avoid errors or add an explicit @return annotation to suppress this message.

How to reproduce

  1. Use symfony 5.4.2
  2. Install aws/aws-sdk-php 3.208.9
  3. Run any unittest that will include aws files

You will get

Method "Countable::count()" might add "int" as a native return type declaration in the future. Do the same in implementation "Aws\HandlerList" now to avoid errors or add an explicit @return annotation to suppress this message.

The code can be found here https://github.com/aws/aws-sdk-php/blob/master/src/HandlerList.php#L308

Possible Solution

No response

Additional Context

No response

@jokaorgua jokaorgua added the Bug label Jan 6, 2022
@jokaorgua jokaorgua changed the title Deprecation message is produce even with [#\ReturnTypeWillChange] Deprecation message is produced even with [#\ReturnTypeWillChange] Jan 6, 2022
@nicolas-grekas
Copy link
Member

Adding the attribute is not enough, you should also tell what is the tentative return type going to be. On that method, that means adding @return int as annotation.
Same logic for all methods that have the attribute of course.

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