diff --git a/.phpcs.xml b/.phpcs.xml index c4ca61e22..b8ec41cfd 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,22 +1,24 @@ - - - - + It's particularly helpful in combination with Phan, which can infer that `$foo` is non-null from + the code above, but it can't infer that `$foo->nextSibling` is non-null in code like this: + while ( $foo->nextSibling && someCondition( $foo->nextSibling ) ) { … } + + When the variable is the only condition, we add extra parentheses to indicate that it isn't a + typo for `==`, which is a convention borrowed from C: + while ( ( $foo = $foo->nextSibling ) ) { … } + --> + + 0 + .