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

Best type hint for setting return #573

Open
alallema opened this issue Aug 23, 2023 · 5 comments
Open

Best type hint for setting return #573

alallema opened this issue Aug 23, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@alallema
Copy link
Contributor

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

@alallema alallema added the enhancement New feature or request label Aug 23, 2023
@tacman
Copy link

tacman commented Dec 3, 2023

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

@norkunas
Copy link
Collaborator

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

@tacman
Copy link

tacman commented Jan 17, 2024

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?

@norkunas
Copy link
Collaborator

norkunas commented Jan 17, 2024

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?

@tacman
Copy link

tacman commented Jan 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants