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

Update jsonSerialize return #1575

Merged
merged 2 commits into from
Apr 30, 2024
Merged

Update jsonSerialize return #1575

merged 2 commits into from
Apr 30, 2024

Conversation

AurelienPillevesse
Copy link
Contributor

@AurelienPillevesse AurelienPillevesse commented Apr 19, 2024

When I execute my test with the last version of packages + PHP 8.3, I have warnings like this one :

1x: Method "JsonSerializable::jsonSerialize()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "OpenApi\Annotations\AbstractAnnotation" now to avoid errors or add an explicit @return annotation to suppress this message.

@DerManoMann
Copy link
Collaborator

Looks like you might have to put all changes into a single PR.

Also, tool did you use to get this warning? I was under the impression that the attribute would take care of this issue.

@AurelienPillevesse AurelienPillevesse changed the title Update jsonSerialize return (AbstractAnnotation) Update jsonSerialize return Apr 19, 2024
@AurelienPillevesse
Copy link
Contributor Author

AurelienPillevesse commented Apr 19, 2024

I use :

  • symfony : 7.0
  • phpunit/phpunit : 9.6.19
  • nelmio/api-doc-bundle : 4.25.3

In my composer.lock, I have zircote/swagger-php : 4.9.0

@DerManoMann
Copy link
Collaborator

So is the warning from PHP itself or from a static analyser or similar?

@AurelienPillevesse
Copy link
Contributor Author

AurelienPillevesse commented Apr 19, 2024

It happens when I run my tests with phpunit but it seems to be a PHP warning itself no ?

@AurelienPillevesse
Copy link
Contributor Author

AurelienPillevesse commented Apr 19, 2024

What about bumping the php version to 8.1 in my commit to make all tests pass (or in another one) ? Because 7.x versions are not maintained anymore (and everything will be green for this PR) : see #1577

@DerManoMann
Copy link
Collaborator

It would be good to get more details as I cannot see those warnings running the swagger-php tests itself.
It would be great if you could provide perhaps a screenshot or the full output from your tests.

@deluxetom
Copy link

I started to see the same warning messages with PHP 8.3 (using symfony 7 and NelmioApiDoc bundle)

@andrew-demb
Copy link

Error triggered from symfony/error-handler - https://github.com/symfony/error-handler/blob/cf97429887e40480c847bfeb6c3991e1e2c086ab/DebugClassLoader.php#L586

It can be fixed with added phpdoc tag @return mixed to avoid BC break about added native return type or bumping min PHP version

@AurelienPillevesse
Copy link
Contributor Author

Added phpdoc in the Abstract class, will be enough I think

@DerManoMann
Copy link
Collaborator

Sorry, got kind of confused about which PR does what. As you can see from my PR there is also a change in the cs-fixer config required. Happy for you to update your PR or use mine.

@DerManoMann DerManoMann merged commit 520ffb7 into zircote:master Apr 30, 2024
21 checks passed
@DerManoMann
Copy link
Collaborator

Thanks @AurelienPillevesse

@AurelienPillevesse AurelienPillevesse deleted the patch-1 branch May 1, 2024 14:04
@AurelienPillevesse
Copy link
Contributor Author

@DerManoMann do you think it's possible to release a new tag to fix this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants