Problem/Motivation

Our documentation allows us to document array values using foo[], but only for classes and interfaces. This prevents us from documenting arrays that contain scalars.

Proposed resolution

Allow any data type for the foo[] syntax, so we can do int[], string[], mixed[], or even array[] for multidimensional arrays.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Comments

dawehner’s picture

I don't see a reason why we should not do it like PSR5 suggests, especially because it is more consistent.

donquixote’s picture

I completely support this.

Even nicer would be if we could document nested array structures beyond just array[]. But I think Php-fig and PhpDoc are not that far yet. (I personally prefer this syntax)
And ideally we should reduce the usage of these nested arrays.

jhodgdon’s picture

I think this is fine. I also think we're already using it.

jhodgdon’s picture

Title: Allow [] to document array data types for scalars as well » [policy] Allow [] to document array data types for scalars as well
Status: Needs review » Reviewed & tested by the community
Issue tags: +Coding standards

Setting up this issue as a proper coding standards change.

We should leave it at RTBC for about a week. If no one objects I'll go ahead and edit the docs standards page (node/1354) and put this in. I do not think it is controversial -- it's a clear extension of the standards we have now, and clarity is what docs are all about. Plus as I said above I think we are already using it, not sure though.

xano’s picture

Awesome!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Policy is hereby adopted; https://drupal.org/coding-standards/docs#types is edited.

xano’s picture

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.