What is allowed between these two:
$value = 'value';
$user = 'John';
$timestamp = 1480927909;
$day = date('Y-m-d', $timestamp);
or
$value = 'value';
$user = 'John';
$timestamp = 1480927909;
$day = date('Y-m-d', $timestamp);
PSR-2 does not have specific rules for this kind of inter-line alignment:
From the PSR-2 Conclusion:
There are many elements of style and practice intentionally omitted by this guide. These include but are not limited to:
- Declaration of global variables and global constants
- Declaration of functions
- Operators and assignment
- Inter-line alignment
- Comments and documentation blocks
- Class name prefixes and suffixes
- Best practices
Future recommendations MAY revise and extend this guide to address those or other elements of style and practice.
For what it's worth, inter-line alignment was discussed for PSR-1 by the PHP-FIG Group, but was removed from the final version:
The way-back original long-form PSR-1 covered inter-line alignment, globals, ternaries, assignment, and lots of other things. Those ended up getting removed for various reasons; their epitaph is at the conclusion of PSR-2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With