Hi,
I'm working on the PSR-12 standard for PHP_CodeSniffer. I have a question
about this section at the bottom of 4.2:
When using the insteadof and as operators they must be used as follows
> taking note of indentation, spacing and new lines.
> <?php
>
> class Talker
> {
> use A, B, C {
> B::smallTalk insteadof A;
> A::bigTalk insteadof C;
> C::mediumTalk as FooBar;
> }
> }
In this code example, insteadof and as have exactly one space on either
side. The text above the example says to note spacing in general. But
PSR-12 also contains this:
6. Operators
> All binary and ternary (but not unary) operators MUST be preceded and
> followed by at least one space. This includes all arithmetic, comparison,
> assignment, bitwise, logical (excluding ! which is unary), string
> concatenation, type operators, trait operators (insteadof and as), and the
> single pipe operator (e.g. ExceptionType1 | ExceptionType2 $e).
Here, instead of and as must be surrounded by at least 1 space - not
exactly 1 space.
So when I'm writing the checks for use blocks, should I be enforcing a
single space around instead of and as, or should I enforce at least one
space? Is this valid code?
<?php
> class Talker
> {
> use A, B, C {
> B::smallTalk insteadof A;
> A::bigTalk insteadof C;
> C::mediumTalk as FooBar;
> }
> }
Thanks
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/php-fig/758b0561-51b5-4619-a24f-91f367aea214%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.