-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] Require detailed iterator types #40
[WIP] Require detailed iterator types #40
Conversation
| trait Foo | ||
| { | ||
| public function bar($baz = [], $qux) : void | ||
| public function bar(string $baz = '', string $qux) : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the change from array to string intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was copied from #32, was just to reduce the amount of changes (as now need to say array of what). But that has been done in some places, so will probably tweak to be consistent (not sure which though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, so not a bug in the auto-fixer! Makes sense though
| { | ||
| public function register() | ||
| /** | ||
| * @return array<int> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to #40 (comment), shouldn't need to re-declare.
|
Work is now happening on slevomat/coding-standard (eg slevomat/coding-standard@4c37991) so will change this PR to use that when it's ready. |
|
Not sure about this having tried it out a bit: since files are read in isolation it requires duplicating on an interface and on the implementation, for example. Might be better in phpstan/phpstan-strict-rules, but will need to contribute it (refs phpstan/phpstan-strict-rules#35). |
|
Closing like #32. Will open a separate PR to require generics-style iterators in doc comments. |
Will be a follow-up to #32 to require annotations defining iterator types. Very much a WIP!
(slevomat/coding-standard#558 was rejected.)