-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve PHPDoc types in Cluster
#2109
base: 8.x
Are you sure you want to change the base?
Conversation
@@ -11,6 +11,26 @@ | |||
* @author Ray Ward <[email protected]> | |||
* | |||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html | |||
* | |||
* @phpstan-type HealthData = array{ |
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.
See my comment in the other PR related to these. The question is likely mostly for my understanding.
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.
* @return string green, yellow or red | ||
* @phpstan-return HealthStatus |
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.
We could use @return 'green'|'yellow'|'red'
instead of introducing virtual class ;-)
see: https://phpstan.org/writing-php-code/phpdoc-types#literals-and-constants
@@ -8,6 +8,20 @@ | |||
* @author Ray Ward <[email protected]> | |||
* | |||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html | |||
* | |||
* @phpstan-import-type HealthStatus from \Elastica\Cluster\Health | |||
* @phpstan-import-type ShardData from Shard |
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.
should we prefer a fully-qualified-class name here?
In order to reach PHPStan level 6, we need to specify iterable types, in this case this is done in the
Cluster
namespace.