Page MenuHomePhabricator

Codesniffer could report !(bool) combination as not necessary
Open, Needs TriagePublic

Description

It is not necessary to cast a value to bool before using the Not-Operator. The cast is implicit on that operator

	/**
	 * @param CosmosConfig $config
	 * @param IContextSource $context
	 * @return bool
	 */
	public static function hookRailsExist(
		CosmosConfig $config,
		IContextSource $context
	) {
		if ( !(bool)static::$railHookContents ) {
			$self = new self( $config, $context );

			$hookContainer = MediaWikiServices::getInstance()->getHookContainer();
			$hookContainer->run( 'CosmosRail', [ $self, $context->getSkin() ] );
		}

		if ( !(bool)static::$railHookContents ) {
			return false;
		}

		return true;
	}

Should not broke code together with the DoubleNotOperator on "!!(bool)"