-
Notifications
You must be signed in to change notification settings - Fork 980
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
Invalid PHPDocs - optional array keys #1424
Comments
To the person looking in to this, optional keys should end with a /**
* @param array{
* id: string, // (REQUIRED) Script ID
* context?: string, // Script context
* timeout?: time, // Explicit operation timeout
* master_timeout?: time, // Specify timeout for connection to master
* pretty?: boolean, // Pretty format the returned JSON response. (DEFAULT: false)
* human?: boolean, // Return human readable values for statistics. (DEFAULT: true)
* error_trace?: boolean, // Include the stack trace of returned errors. (DEFAULT: false)
* source?: string, // The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
* filter_path?: string, // A comma-separated list of filters used to reduce the response.
* body: array, // (REQUIRED) The document
* } $params Also |
This is also the case for Cluster::health()? The PHPDoc specifies Causing PHPStan to:
Perhaps this should be handled throughout the entire repository right from the start? Thanks for bringing this up and putting the time in this fast! |
Thanks @AJenbo, @AnnaNtagiou and @kostirez1 for your feedback. I need to update and fix some of these PHPDoc, when I implemented this was a very experimental feature. |
A lot of PHPDocs were invalid as they had comments at the EOL.
After PHPStan 2.1.6, which supports comments at EOL, the PHPDocs are valid but incorrect. There are array keys that are not required but are not defined as optional.
For example, in ClientEndpointsTrait we have this PHPDoc.
While only the
id
andbody
keys are required, the rest of the keys are not optional.The text was updated successfully, but these errors were encountered: