mediawiki-extensions-Discus.../.phpcs.xml
libraryupgrader 32fc8c5ea9 build: Updating mediawiki/mediawiki-codesniffer to 44.0.0
The following sniffs are failing and were disabled:
* Generic.CodeAnalysis.AssignmentInCondition.Found
* Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition

The following sniffs now pass and were enabled:
* Generic.CodeAnalysis.AssignmentInCondition

Change-Id: I8adfdce01ea96f4b62dabd3dea130f9593c7e5ac
2024-08-11 06:40:14 +00:00

24 lines
1 KiB
XML

<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<!--
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 ) ) { … }
-->
</rule>
<file>.</file>
<arg name="extensions" value="php" />
<arg name="encoding" value="UTF-8" />
</ruleset>