Skip to content
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

Requests::request_multiple() should have the option documentation in phpDoc #435

Open
johnbillion opened this issue Nov 13, 2020 · 3 comments

Comments

@johnbillion
Copy link
Member

From https://core.trac.wordpress.org/ticket/48349:

Currently, the $options argument field is documented in the description:

https://developer.wordpress.org/reference/classes/requests/request_multiple/

I believe it could be documented using phpDoc directly like

@param array $options {
    Description.

    @type ...
}

Patch at https://core.trac.wordpress.org/attachment/ticket/48349/48349.2.patch

@jrfnl
Copy link
Member

jrfnl commented Nov 13, 2020

@johnbillion The @param array annotation used within WordPress is specific to WordPress and not recognized anywhere else, not in PSR 5/19, not in tooling like phpDocumentor etc.

As this package is not WP specific, I'd rather not use WP specific annotations.

@johnbillion
Copy link
Member Author

Correct but as far as I know (although I don't follow them closely) neither PSR-5 nor PSR-19 propose such a syntax. What alternatives are there?

@jrfnl
Copy link
Member

jrfnl commented Nov 13, 2020

Either documenting the value as was done already, as part of the description. This is a common pattern.

Alternatively, a pattern like seen here can be used, where the @return tag contains a code sample of what the returned array looks like: https://github.com/PHPCSStandards/PHPCSUtils/blob/c677ffcf8b566ed5bf92b74a94a29241e969feda/PHPCSUtils/Utils/PassedParameters.php#L174-L185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants