r106851 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106850‎ | r106851 | r106852 >
Date:20:15, 20 December 2011
Author:demon
Status:ok (Comments)
Tags:
Comment:
Simplify $assoc check
Modified paths:
  • /trunk/phase3/includes/json/FormatJson.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/json/FormatJson.php
@@ -54,10 +54,8 @@
5555 */
5656 public static function decode( $value, $assoc = false ) {
5757 if ( !function_exists( 'json_decode' ) ) {
58 - if( $assoc )
59 - $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE );
60 - else
61 - $json = new Services_JSON();
 58+ $json = $assoc ? new Services_JSON( SERVICES_JSON_LOOSE_TYPE ) :
 59+ new Services_JSON();
6260 $jsonDec = $json->decode( $value );
6361 return $jsonDec;
6462 } else {

Comments

#Comment by Aaron Schulz (talk | contribs)   20:21, 20 December 2011

We usually prefer:

$x = <cond>
    ? <a>
    : <b>
#Comment by 😂 (talk | contribs)   20:23, 20 December 2011

I wrapped it at 77 chars. Do we have a specific mention about adding a newline here in the conventions? News to me.

#Comment by Nikerabbit (talk | contribs)   07:29, 21 December 2011

Having multiline ?: doesn't seem to be a improvement to me.

Status & tagging log