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

(Weak) generics on ide-helper:models array types. #1614

Open
LauJosefsen opened this issue Nov 19, 2024 · 0 comments
Open

(Weak) generics on ide-helper:models array types. #1614

LauJosefsen opened this issue Nov 19, 2024 · 0 comments

Comments

@LauJosefsen
Copy link

Summary

Hi.

Since the higher PHPStan levels wants generics on array types, I was wondering how you would feel about changing array properties on models from

 * @property array|null $metadata

to

 * @property array<array-key, mixed>|null $metadata

This looks like it could be a small change to the ModelsCommand https://github.com/barryvdh/laravel-ide-helper/blob/master/src/Console/ModelsCommand.php#L392 to

                case 'array':
                case 'json':
                    $realType = 'array<array-key, mixed>';

Alternatively it would be nice to be able to implement this using the Barryvdh\LaravelIdeHelper\Contracts\ModelHookInterface, but I think a public getter to properties in \Barryvdh\LaravelIdeHelper\Console\ModelsCommand is needed.

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

No branches or pull requests

1 participant