Flip Yoda conditionals

Change-Id: Id3495b6f15c267123c89f3a0ace496e6ecbeb58e
This commit is contained in:
Ed Sanders 2020-07-22 17:49:12 +01:00
parent 3a1faac376
commit 0cf40a4f7a
7 changed files with 12 additions and 12 deletions

View file

@ -76,7 +76,7 @@ class AutoLoader {
if ( !$filename && strpos( $className, '\\' ) !== false ) {
// This class is namespaced, so try looking at the namespace map
$prefix = $className;
while ( false !== $pos = strrpos( $prefix, '\\' ) ) {
while ( ( $pos = strrpos( $prefix, '\\' ) ) !== false ) {
// Check to see if this namespace prefix is in the map
$prefix = substr( $className, 0, $pos + 1 );
if ( isset( self::$psr4Namespaces[$prefix] ) ) {

View file

@ -1473,7 +1473,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isUserCssConfigPage() {
return (
NS_USER == $this->mNamespace
$this->mNamespace == NS_USER
&& $this->isSubpage()
&& $this->hasContentModel( CONTENT_MODEL_CSS )
);
@ -1487,7 +1487,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isUserJsonConfigPage() {
return (
NS_USER == $this->mNamespace
$this->mNamespace == NS_USER
&& $this->isSubpage()
&& $this->hasContentModel( CONTENT_MODEL_JSON )
);
@ -1501,7 +1501,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isUserJsConfigPage() {
return (
NS_USER == $this->mNamespace
$this->mNamespace == NS_USER
&& $this->isSubpage()
&& $this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
);
@ -1515,7 +1515,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isSiteCssConfigPage() {
return (
NS_MEDIAWIKI == $this->mNamespace
$this->mNamespace == NS_MEDIAWIKI
&& (
$this->hasContentModel( CONTENT_MODEL_CSS )
// paranoia - a MediaWiki: namespace page with mismatching extension and content
@ -1533,7 +1533,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isSiteJsonConfigPage() {
return (
NS_MEDIAWIKI == $this->mNamespace
$this->mNamespace == NS_MEDIAWIKI
&& (
$this->hasContentModel( CONTENT_MODEL_JSON )
// paranoia - a MediaWiki: namespace page with mismatching extension and content
@ -1551,7 +1551,7 @@ class Title implements LinkTarget, IDBAccessObject {
*/
public function isSiteJsConfigPage() {
return (
NS_MEDIAWIKI == $this->mNamespace
$this->mNamespace == NS_MEDIAWIKI
&& (
$this->hasContentModel( CONTENT_MODEL_JAVASCRIPT )
// paranoia - a MediaWiki: namespace page with mismatching extension and content

View file

@ -162,7 +162,7 @@ class WikitextContentHandler extends TextContentHandler {
$fields['defaultsort'] = $structure->getDefaultSort();
// Until we have full first-class content handler for files, we invoke it explicitly here
if ( NS_FILE == $page->getTitle()->getNamespace() ) {
if ( $page->getTitle()->getNamespace() == NS_FILE ) {
$fields = array_merge( $fields,
$this->getFileHandler()->getDataForSearchIndex( $page, $parserOutput, $engine ) );
}

View file

@ -206,7 +206,7 @@ class FormatJson {
$value, -1, $count );
if ( $count > 0 ) {
$result = json_decode( $value, $assoc );
if ( JSON_ERROR_NONE === json_last_error() ) {
if ( json_last_error() === JSON_ERROR_NONE ) {
// Report warning
$st = Status::newGood( $result );
$st->warning( wfMessage( 'json-warn-trailing-comma' )->numParams( $count ) );

View file

@ -192,7 +192,7 @@ class Article implements Page {
* @return Article
*/
public static function newFromTitle( $title, IContextSource $context ) {
if ( NS_MEDIA == $title->getNamespace() ) {
if ( $title->getNamespace() == NS_MEDIA ) {
// XXX: This should not be here, but where should it go?
$title = Title::makeTitle( NS_FILE, $title->getDBkey() );
}

View file

@ -143,7 +143,7 @@ class WatchedItem {
* @return bool
*/
public function isExpired(): bool {
if ( null === $this->getExpiry() ) {
if ( $this->getExpiry() === null ) {
return false;
}

View file

@ -2963,7 +2963,7 @@ class Language {
// Break down Hangul syllables to grab the first jamo
$code = mb_ord( $firstChar );
if ( $code < 0xac00 || 0xd7a4 <= $code ) {
if ( $code < 0xac00 || $code >= 0xd7a4 ) {
return $firstChar;
} elseif ( $code < 0xb098 ) {
return "\u{3131}";