Closed adrianb93 closed 3 months ago
Feature suggestion ✌️
pint
I only recently discovered that instead of doing this:
/** @var array<class-string> */ public array $events; // or this /** @var array<int, class-string> */ public array $events;
That I should do this:
/** @var list<class-string> */ public array $events;
Where the rule should apply:
# Before /** @var array<class-string> */ public array $events; # After /** @var list<class-string> */ public array $events;
Caveat where the rule shouldn't apply:
I don't think we should assume this is a list just because the key is an integer.
# Before /** @var array<int, class-string> */ public array $events; # After /** @var array<int, class-string> */ public array $events;
I don't think no specificity should mean it's a list:
# Before /** @var array */ public array $events; # After /** @var array */ public array $events;
Hi there,
Laravel preset prefers array over list and that has been the standard for now. You may be able to add custom rules to allow this if it's available via php-cs-fixer
array
list
php-cs-fixer
Feature suggestion ✌️
What if
pint
could correct array type hints in the docblocks.I only recently discovered that instead of doing this:
That I should do this:
Examples
Where the rule should apply:
Caveat where the rule shouldn't apply:
I don't think we should assume this is a list just because the key is an integer.
I don't think no specificity should mean it's a list: