From: Timo Tijhof Date: Wed, 1 Apr 2015 08:48:30 +0000 (+0100) Subject: Use "string|false" as @return instead of "string|bool" where appropiate X-Git-Tag: 1.31.0-rc.0~11893^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=532337e6ff57b280a845ab35036527ffbcc58c73;p=lhc%2Fweb%2Fwiklou.git Use "string|false" as @return instead of "string|bool" where appropiate This makes sure static analyzers don't warn for supposedly unsafe code accessing variables as strings when they could be boolean after having only checked against false. https://github.com/scrutinizer-ci/php-analyzer/issues/605 Change-Id: Idb676de7587f1eccb46c12de0131bea4489a0785 --- diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 7110361066..ed0f3c2d4c 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -349,7 +349,7 @@ TXT; * returns the requested URL. Otherwise, returns false. * * @since 1.23 - * @return string|bool + * @return string|false */ public static function getURL() { global $wgRequest; @@ -428,7 +428,7 @@ TXT; * @param Exception $e * @param bool $pretty Add non-significant whitespace to improve readability (default: false). * @param int $escaping Bitfield consisting of FormatJson::.*_OK class constants. - * @return string|bool JSON string if successful; false upon failure + * @return string|false JSON string if successful; false upon failure */ public static function jsonSerializeException( Exception $e, $pretty = false, $escaping = 0 ) { global $wgLogExceptionBacktrace; diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index f27194a44b..095811ff53 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -122,7 +122,7 @@ class FormatJson { * readability, using that string for indentation. If true, use the default indent * string (four spaces). * @param int $escaping Bitfield consisting of _OK class constants - * @return string|bool: String if successful; false upon failure + * @return string|false String if successful; false upon failure */ public static function encode( $value, $pretty = false, $escaping = 0 ) { if ( !is_string( $pretty ) ) { @@ -232,7 +232,7 @@ class FormatJson { * @param mixed $value * @param string|bool $pretty * @param int $escaping - * @return string|bool + * @return string|false */ private static function encode54( $value, $pretty, $escaping ) { static $bug66021; @@ -284,7 +284,7 @@ class FormatJson { * @param mixed $value * @param string|bool $pretty * @param int $escaping - * @return string|bool + * @return string|false */ private static function encode53( $value, $pretty, $escaping ) { $options = ( $escaping & self::XMLMETA_OK ) ? 0 : ( JSON_HEX_TAG | JSON_HEX_AMP );