Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Conversation

@thewilkybarkid
Copy link
Contributor

Will be a follow-up to #32 to require annotations defining iterator types. Very much a WIP!

(slevomat/coding-standard#558 was rejected.)

@thewilkybarkid thewilkybarkid added the feature New feature or request label Jan 7, 2019
@thewilkybarkid thewilkybarkid requested a review from a team as a code owner January 7, 2019 13:30
trait Foo
{
public function bar($baz = [], $qux) : void
public function bar(string $baz = '', string $qux) : void

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?

Copy link
Contributor Author

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).

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>
Copy link
Contributor Author

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.

@thewilkybarkid
Copy link
Contributor Author

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.

@thewilkybarkid
Copy link
Contributor Author

That was quick!

@thewilkybarkid
Copy link
Contributor Author

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).

@thewilkybarkid
Copy link
Contributor Author

Closing like #32. Will open a separate PR to require generics-style iterators in doc comments.

@thewilkybarkid thewilkybarkid deleted the require-iterable-types branch February 15, 2019 11:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants