laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

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

Open LauJosefsen opened this issue 11 months ago • 2 comments

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.

LauJosefsen avatar Nov 19 '24 14:11 LauJosefsen