Skip to content

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

Open
@LauJosefsen

Description

@LauJosefsen

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions