meilisearch / meilisearch-php

PHP wrapper for the Meilisearch API

Home Page:https://meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best type hint for setting return

alallema opened this issue · comments

Description
Following this comment from @norkunas the type hints of returns are not indicated in the HandleSettings file. It might be a good idea to specify that the latter return tasks.

Possible solutions

  • Declare the Task return type in some file and then import the type where a task is returned
  • Introduce some value object that would hold the task info

This could be also done in other files

I'm also getting a deprecation on Meilisearch\Contracts\Data

"exception" => ErrorException {
#message: "User Deprecated: Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Meilisearch\Contracts\Data" now to avoid errors or add an explicit @return annotation to suppress this message."
#code: 0

@tacman and how this is related to the original issue? :)

title: "Best type hint for setting return "
issue: "User Deprecated: Method "ArrayAccess::offsetGet()" might add "mixed" as a native return type declaration

related in that they both refer to return type declaration, yes?

Just trying to help cleanup the sometimes noisy deprecation warnings! Was I wrong to add this here?

It would be easier to track as a separate issue :)

Also - does it fix your issue if you'd add @return mixed in src/Contracts/Data.php above the offsetGet method declaration?

okay, though they seem related to me. I guess I could reference one from the other.

I assume that fix would work, but I haven't forked it for testing, so I was just looking for a place to report the deprecation.