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 a Return Type using PHPDoc to fix IDE Autocomplete #292

Merged

Conversation

TaylorWilton
Copy link
Contributor

@TaylorWilton TaylorWilton commented Sep 9, 2024

Hi 👋

I've also been affected by the IDE autocompletion issue noted in #285 and #287.

image
image

I figured since it was a simple PR and no-one else had done it yet I may as well create it.

My understanding of the issue is that the make function can't define a return type, because the result could be a Decorator, or the actual action. However, without docblocks or type-hinting, PHPStorm ends up providing the autocompletion for the handle function defined in the application container, which is different.

I've returned the docblock here, which resolves the issue for me locally, and won't cause any type errors.

Thanks for your work maintaining this package!

(e: sorry for the force push mixup - on a work laptop and had to change git accounts 😅 )

@TaylorWilton TaylorWilton force-pushed the feature/fix-as-object-dockblock branch from d381b22 to 96247db Compare September 9, 2024 21:17
The make function can't define a return type, because the result could be a Decorator, or the actual action.
However, without docblocks or type-hinting, PHPStorm ends up providing incorrect autocomplete information.
The solution is to instead add back a phpdoc comment for this specific use case.

See lorisleiva#285 and lorisleiva#287 for more details.
@TaylorWilton TaylorWilton force-pushed the feature/fix-as-object-dockblock branch from 96247db to 794d8e6 Compare September 9, 2024 21:18
Copy link
Owner

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tysm! 🫶

@lorisleiva lorisleiva merged commit 5a168bf into lorisleiva:main Sep 10, 2024
8 checks passed
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.

2 participants