Skip to content

Invalid PHPDocs - optional array keys #1424

Closed
@AnnaNtagiou

Description

@AnnaNtagiou

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.

         * @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: list, // A comma-separated list of filters used to reduce the response.
	 *     body: array, // (REQUIRED) The document
	 * } $params

While only the id and body keys are required, the rest of the keys are not optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions