2020-01-13 19:48:11 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<ruleset>
|
2024-08-31 21:04:41 +00:00
|
|
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
2024-03-10 21:57:41 +00:00
|
|
|
|
2024-08-31 21:04:41 +00:00
|
|
|
<!--
|
|
|
|
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.
|
2024-03-10 21:57:41 +00:00
|
|
|
|
2024-08-31 21:04:41 +00:00
|
|
|
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 ) ) { … }
|
|
|
|
-->
|
|
|
|
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
|
|
|
|
<severity>0</severity>
|
2019-12-10 02:38:17 +00:00
|
|
|
</rule>
|
2024-08-31 21:04:41 +00:00
|
|
|
|
2020-01-13 19:48:11 +00:00
|
|
|
<file>.</file>
|
2020-10-29 10:52:56 +00:00
|
|
|
<arg name="extensions" value="php" />
|
2020-01-13 19:48:11 +00:00
|
|
|
<arg name="encoding" value="UTF-8" />
|
|
|
|
</ruleset>
|