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

Add return types to MessageResponseTrait to match upcoming PSR interface #1251

Closed
wants to merge 1 commit into from

Conversation

hacfi
Copy link
Contributor

@hacfi hacfi commented Sep 10, 2022

I was getting several deprecations notices so I added the return types that will be added to the PSR interfaces we use.

For completeness here are the messages:

User Deprecated: Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::getProtocolVersion()" might add "string" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::withProtocolVersion()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::getHeaders()" might add "array" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::hasHeader()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::getHeader()" might add "array" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::getHeaderLine()" might add "string" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::withHeader()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::withAddedHeader()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::withoutHeader()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::getBody()" might add "StreamInterface" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\MessageInterface::withBody()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\ResponseInterface::getStatusCode()" might add "int" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\ResponseInterface::withStatus()" might add "static" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

User Deprecated: Method "Psr\Http\Message\ResponseInterface::getReasonPhrase()" might add "string" as a native return type declaration in the future. Do the same in implementation "Elastic\Elasticsearch\Response\Elasticsearch" now to avoid errors or add an explicit @return annotation to suppress this message.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@hacfi
Copy link
Contributor Author

hacfi commented Sep 10, 2022

So unfortunately static (https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.static) was added in PHP 8.0. Not sure how you want to proceed with this issue @ezimuel .

@ezimuel
Copy link
Contributor

ezimuel commented Sep 29, 2022

@hacfi which version of PHP and elasticsearch-php are you using? Thanks.

@hacfi
Copy link
Contributor Author

hacfi commented Sep 30, 2022

@ezimuel I'm using PHP 8.1.9 and elasticsearch-php 8.4.0. These notices come from Symfony (6.1.5).

@hacfi
Copy link
Contributor Author

hacfi commented Oct 1, 2022

Just rebased the the latest master and the issue persists:
image

@mrichter1234
Copy link

This issue has existed since October 2022. Which version fixed it? It's a depression from PHP >8.1 / Symonfy > 6.1. ...

@ezimuel
Copy link
Contributor

ezimuel commented May 23, 2023

Sorry for the late reply. I fixed this issue with 6bd60df. @hacfi and @mrichter1234 let me know if this solve your issue, thanks!

@ezimuel ezimuel closed this May 23, 2023
@mrichter1234
Copy link

Thanks @ezimuel. It seems that the following passage has been forgotten. This continues to bring deprecated.
Can you please fix it with the next version.

image
image

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.

None yet

4 participants