What\'s the PSR-2 Standard coding convention for initialization of arrays and method chaining?
$foo = array(
\'one\' => 1,
\'two\' => 2
);
$rows =
PSR-2 currently doesn't specify neither
PS: even in new standards (when having BC cannot be a justification) PHP cannot be straightforward and there are confusing requirements like:
When present, the abstract and final declarations MUST precede the visibility declaration.
When present, the static declaration MUST come after the visibility declaration.
Stay classy, PHP
At this stage neither of those are explicitly covered in the PSR-2 standard. In the conclusion it does note that a number of areas are intentionally omitted, including:
- Operators and assignment
- Inter-line alignment
The only relevant guidelines would be the more general ones regarding things like line lengths and number of spaces for indenting.
Other standards that do deal with those subjects include PEAR and Zend.