Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Return typehits of primitive values #21

Closed
mikemand opened this issue Aug 20, 2020 · 1 comment
Closed

Return typehits of primitive values #21

mikemand opened this issue Aug 20, 2020 · 1 comment

Comments

@mikemand
Copy link

It looks like the return typehints that are primitive values (bool, array, string, etc.) are being handled like they need a namespace. For example:

public static function validate($callback): \bool {

or

public static function pluckToArray($value, $key = NULL): \array {

This doesn't seem to matter for bool. However, if the return is array, prefixing it with a backslash causes the interpreter to freak out and nothing after that line is interpreted by the IDE. The error messages my IDE throw are: "Method should either have body or be abstract" and "Unexpected: array".

To reproduce, create a new Laravel app and install your package and Spatie's Collection Macros:

laravel new ide-macro-test && \
cd ide-macro-test && \
composer require spatie/laravel-collection-macros tutorigo/laravel-ide-macros && \
php artisan ide-helper:macros

Check line 72 of _ide_macros.php.

@KristofMorva
Copy link
Owner

Thanks for letting us know, probably PR #19 broke it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants