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
When running jane on this, the client will get generated with phpdoc like:
<?phpnamespaceGenerated;
classClientextends \Generated\Runtime\Client\Client
{
/** * @return null|\Psr\Http\Message\ResponseInterface */publicfunctionpostCreate(/*...*/)
{
// ... deserialize code here will return something like 1.
}
}
Note the missing int in the return types.
When now we run some tool like rector or the code style fixer on this, the return types will get propagated to native return types
<?phpnamespaceGenerated;
classClientextends \Generated\Runtime\Client\Client
{
publicfunctionpostCreate(/*...*/): null|\Psr\Http\Message\ResponseInterface
{
// BUG: ... deserialize code here will return something like 1 and therefore throw an type error here.
}
}
Possible Solution
I gave it a quick shot an implemented the following solution, I do not know however if the list of handled types is exhaustive:
Jane version(s) affected: 7.6.1 (probably all)
Description
How to reproduce
consider openapi3.json with the following endpoint (irrelevant parts have been omitted):
When running jane on this, the client will get generated with phpdoc like:
Note the missing
int
in the return types.When now we run some tool like rector or the code style fixer on this, the return types will get propagated to native return types
Possible Solution
I gave it a quick shot an implemented the following solution, I do not know however if the list of handled types is exhaustive:
The base code is derived from the parameter handling in the non body parameter generator:
janephp/src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php
Lines 173 to 198 in 5ff401d
The text was updated successfully, but these errors were encountered: