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

[PHP] ArrayAccess methods in Models missing return types #11820

Closed
AlexSBlackburn opened this issue Jun 28, 2022 · 0 comments · Fixed by #11846
Closed

[PHP] ArrayAccess methods in Models missing return types #11820

AlexSBlackburn opened this issue Jun 28, 2022 · 0 comments · Fixed by #11846

Comments

@AlexSBlackburn
Copy link

Description

Swagger Client Models implement the ArrayAccess interface and use the offset methods (offsetExists(), offsetGet(), offsetSet() and offsetUnset()). These methods are missing return types, causing warnings to be generated.

For example:
Return type of Swagger\Client\{ClientName}\Model\{ModelName}::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/{vendor-name}/{package-name}/lib/Model/{ModelName}.php on line 330

Swagger-codegen version

3.0.34

Suggest a fix/enhancement

Add return types to the method declarations in https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/php/model_generic.mustache#L397

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 a pull request may close this issue.

1 participant