The PSR-2 standard specifically omits any opinion on operators:
There are many elements of style and practice deliberately omitted by this guide. These include, but are not limited to: ... Operators and purpose
Since brackets are used to group expressions, your example does not make much sense:
$error = ($error_status) ? 'Error' : 'No Error';
It makes no sense to surround one variable in parentheses. A more complex condition may benefit from parentheses, but in most cases they will be read-only.
A more general template would be to always surround the entire three-dimensional expression:
$error = ($error_status ? 'Error' : 'No Error');
The main motivation for this is that the ternary operator in PHP has a rather inconvenient associativity and priority, so using it in complex expressions often gives unexpected / useless results.
The usual case is string concatenation, for example:
$error = 'Status: ' . $error_status ? 'Error' : 'No Error';
Here, the concatenation operator ( . ) Is actually evaluated before the ternary operator, so the condition is always a non-empty string (the beginning of 'Status: ' ), and you will always get the string Error' as the result.
To prevent this, parentheses are required:
$error = 'Status: ' . ($error_status ? 'Error' : 'No Error');
A similar situation exists when the “triple expressions” for forming the equivalent of the if-elseif chain, like an error at the beginning of the PHP history, mean that several ternary operators are evaluated sequentially from left to right, and do not reduce the entire false branch when the condition is true.
An example from the PHP manual explains this more clearly:
// on first glance, the following appears to output 'true' echo (true?'true':false?'t':'f'); // however, the actual output of the above is 't' // this is because ternary expressions are evaluated from left to right // the following is a more obvious version of the same code as above echo ((true ? 'true' : false) ? 't' : 'f'); // here, you can see that the first expression is evaluated to 'true', which // in turn evaluates to (bool)true, thus returning the true branch of the // second ternary expression.