The scenario you describe would be better served by parentheses, methinks.
No, they aren't strictly necessary, but forcing the reader to think back to
PEMDAS while reading through code rather than just looking at the
parentheses...well...same sort of idea as requiring braces around
single-ststement control flow blocks.

On Fri, Aug 3, 2018, 4:11 AM Magnar Ovedal Myrtveit <mag...@myrtveit.com>
wrote:

> PSR-12 states that
>
> All binary and ternary (but not unary) operators MUST be preceded and
>> followed by at least one space
>
>
> Sometimes I find it useful to write arithmetic operators without
> surrounding whitespace, since it can help make the meaning clear at a
> glance.
>
> Consider this very simple example:
> $foo = 1 + 2*3 + 4 - 5/7; // Syntax indicates the order in which the
> operations are performed.
> $bar = 1 + 2 * 3 + 4 - 5 / 7; // Syntax does not indicate anything.
>
> What are the reasons for requiring surrounding whitespace for (arithmetic)
> operators?
>
> Magnar :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "PHP Framework Interoperability Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to php-fig+unsubscr...@googlegroups.com.
> To post to this group, send email to php-fig@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/php-fig/5ba39cf5-f2ee-4581-9cfb-bc6acec0e19e%40googlegroups.com
> <https://groups.google.com/d/msgid/php-fig/5ba39cf5-f2ee-4581-9cfb-bc6acec0e19e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CAAupm8i9OGvyFC31ptA8NdDxGyOJZDaE1tzD4aJOz6YFHSwPWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to