You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When I use a Symfony bundle generated by openApiGenerator, Symfony display this warning:
Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "OpenAPI\Server\OpenAPIServerBundle" now to avoid errors or add an explicit @return annotation to suppress this message
openapi-generator version
I've observed this behavior with openapi-generator 6.6.0. I've also reproduced it with a version built from source with today's master branch (d5c53b9)
OpenAPI declaration file content or url
It can be observed with any OpenAPI file. Let's take for instance this simple one:
openapi: 3.0.1info:
title: Testversion: 0.0.1paths:
/my-route:
get:
summary: Get stuffresponses:
"200":
description: OK
Plus the generated Symfony bundle into a Symfony app (following the steps in the auto-generated README). Then launch the Symfony server (symfony server:start --no-tls) and perform a query against this route curl http://localhost:8000/my-route
Expected behavior: Symfony handle this query without outputting warning because of the generated code.
Actual behavior: Symfony output this warning (on the server stdout): Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "OpenAPI\Server\OpenAPIServerBundle" now to avoid errors or add an explicit @return annotation to suppress this message
(nb: there is another similar warning, related to a method in the jms/serializer-bundle package. I'm leaving it out of the scope of this bug report because I think it would deserve its own bug report (because the fix would not really be the same since that other warning would rather imply a bump of that jms package))
Related issues/PRs
I searched for related issues and PRs, but did not found any.
Suggest a fix
The fix is easy: we just need to declare a void return type for that method, by editing modules/openapi-generator/src/main/resources/php-symfony/Bundle.mustache . This is fixed by PR #15960
The text was updated successfully, but these errors were encountered:
This fixes this Symfony warning:
User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()"
might add "void" as a native return type declaration in the future. Do the
same in child class "OpenAPI\Server\OpenAPIServerBundle" now to avoid errors
or add an explicit @return annotation to suppress this message
This fixesOpenAPITools#15959
Bug Report Checklist
Description
When I use a Symfony bundle generated by openApiGenerator, Symfony display this warning:
Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "OpenAPI\Server\OpenAPIServerBundle" now to avoid errors or add an explicit @return annotation to suppress this message
openapi-generator version
I've observed this behavior with openapi-generator 6.6.0. I've also reproduced it with a version built from source with today's master branch (d5c53b9)
OpenAPI declaration file content or url
It can be observed with any OpenAPI file. Let's take for instance this simple one:
Generation Details
Steps to reproduce
Plus the generated Symfony bundle into a Symfony app (following the steps in the auto-generated README). Then launch the Symfony server (
symfony server:start --no-tls
) and perform a query against this routecurl http://localhost:8000/my-route
Expected behavior: Symfony handle this query without outputting warning because of the generated code.
Actual behavior: Symfony output this warning (on the server stdout):
Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "OpenAPI\Server\OpenAPIServerBundle" now to avoid errors or add an explicit @return annotation to suppress this message
(nb: there is another similar warning, related to a method in the jms/serializer-bundle package. I'm leaving it out of the scope of this bug report because I think it would deserve its own bug report (because the fix would not really be the same since that other warning would rather imply a bump of that jms package))
Related issues/PRs
I searched for related issues and PRs, but did not found any.
Suggest a fix
The fix is easy: we just need to declare a
void
return type for that method, by editingmodules/openapi-generator/src/main/resources/php-symfony/Bundle.mustache
. This is fixed by PR #15960The text was updated successfully, but these errors were encountered: