Skip to content

Model's --write duplicates array properties that have summary and array key-value types added #1505

Closed
barryvdh/ReflectionDocBlock
#16
@E4SdJG528X9FsnpaBz6yxw

Description

@E4SdJG528X9FsnpaBz6yxw

Versions:

  • ide-helper Version: dev-master 6336db0
  • Laravel Version: 10.22.0
  • PHP Version: 8.2.4

Description:

After specifying the key and value type for an Eloquent Model's array @property and adding a comment after that - it duplicates the property.

Steps To Reproduce:

  • have the Models that has an array or json column (eg Client model has address_values property that is json typed in DB);
  • run php artisan ide-helper:models App\\Models\\Client --write;
  • check that your Client model's phpDoc now has @property array|null $address_values;
  • specify array key-value types and add a summary for the property - @property array<string, string>|null $address_values some description;
  • run php artisan ide-helper:models App\\Models\\Client --write;
  • check that it now added / duplicated the $address_values property.

It works as expected for these variants:

  • @property array|null $address_values some description -- no array key-value types;
  • @property array<string, string>|null $address_values -- no description / summary / text after the property name.

Expected behavior is to be able to add both array's key-value types and description (I write some examples there).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions