Page MenuHomePhabricator

codesniffer detects unparenthesized ternary in mediawiki/core Article.php
Closed, ResolvedPublic

Description

FILE: includes\page\Article.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 656 | ERROR | Nested inline ternary statements, in PHP, may not
     |       | behave as you intend without parentheses
     |       | (MediaWiki.Usage.NestedInlineTernary.UnparenthesizedTernary)
----------------------------------------------------------------------

Code is:

		# Get the ParserOutput actually *displayed* here.
		# Note that $this->mParserOutput is the *current*/oldid version output.
		$pOutput = ( $outputDone instanceof ParserOutput )
			? $outputDone // object fetched by hook
			: $this->mParserOutput ?: null; // ParserOutput or null, avoid false

Was added with https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/453190/

Event Timeline

Jdforrester-WMF subscribed.

(Follows-up T174035)

That'd make this an MCR concern, not an SDC one.

Change 469025 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] Follow-up T174035: Wrap inline ternary in brackets to make phpcs happy

https://gerrit.wikimedia.org/r/469025

Change 469025 merged by jenkins-bot:
[mediawiki/core@master] Follow-up T174035: Wrap inline ternary in brackets to make phpcs happy

https://gerrit.wikimedia.org/r/469025