Looking for which (if either) of the following ternary statement\'s syntax is compliant with PSR-2 - I
Common convention is always simplify. PSR standard goes a way that
$error = $error_status ? 'Error' : 'No Error';
Seems more cleaner than parentheses.
If you want explicit more readability, the PSR-2 standard goes to:
if ($error_status) {
$error = 'Error';
else {
$error = 'No Error';
}
It's all. PSR it's a standard to better understand our code, when you write a code like you are providing, you're going deeper on simplification, and there's no limitation to your imagination, just avoid not exceed PSR rules.
Use PHP Code Sniffer to check-out your code on PSR1 and PSR2 rules.
Code Sniffer