mediawiki-extensions-Discus.../.phpcs.xml
Bartosz Dziewoński b16dd9dd96 Update PHPCS overrides
There's now a different rule for the same thing in
mediawiki/mediawiki-codesniffer v43.0.0. Also document the reason for
the override. Follow-up to 8b00546749.

Change-Id: I392ee10639ffda6de55b091555e8c3cadd2af485
2024-03-10 22:59:05 +01:00

23 lines
956 B
XML

<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<!--
Code such as this:
while ( ( $foo = $foo->nextSibling ) && someCondition( $foo ) ) { … }
is often convenient when working on DOM tree structures, which we do a lot of in this extension.
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 ) ) { … }
-->
<exclude name="Generic.CodeAnalysis.AssignmentInCondition" />
</rule>
<file>.</file>
<arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" />
</ruleset>