X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatJson.php;h=41de9253f6d70f14f99fb36a89311ecc631746c0;hb=633c0da23af1cdb16f8edb6252f1c1138422162c;hp=a319be394346e970369ed27bcea68462b8abd1ed;hpb=c97d773e1427a8827e3e6889547cd054c51c86e7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index a319be3943..41de9253f6 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -42,7 +42,7 @@ class ApiFormatJson extends ApiFormatBase { # outside the control of the end user. # (and do it here because ApiMain::reportUnusedParams() gets called # before our ::execute()) - $this->getMain()->getCheck( '_' ); + $this->getMain()->markParamsUsed( '_' ); } } @@ -71,25 +71,25 @@ class ApiFormatJson extends ApiFormatBase { $opt = 0; if ( $this->isRaw ) { $opt |= FormatJson::ALL_OK; - $transform = array(); + $transform = []; } else { switch ( $params['formatversion'] ) { case 1: $opt |= $params['utf8'] ? FormatJson::ALL_OK : FormatJson::XMLMETA_OK; - $transform = array( - 'BC' => array(), - 'Types' => array( 'AssocAsObject' => true ), + $transform = [ + 'BC' => [], + 'Types' => [ 'AssocAsObject' => true ], 'Strip' => 'all', - ); + ]; break; case 2: case 'latest': $opt |= $params['ascii'] ? FormatJson::XMLMETA_OK : FormatJson::ALL_OK; - $transform = array( - 'Types' => array( 'AssocAsObject' => true ), + $transform = [ + 'Types' => [ 'AssocAsObject' => true ], 'Strip' => 'all', - ); + ]; break; default: @@ -121,27 +121,27 @@ class ApiFormatJson extends ApiFormatBase { public function getAllowedParams() { if ( $this->isRaw ) { - return array(); + return parent::getAllowedParams(); } - $ret = array( - 'callback' => array( + $ret = parent::getAllowedParams() + [ + 'callback' => [ ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-callback', - ), - 'utf8' => array( + ], + 'utf8' => [ ApiBase::PARAM_DFLT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-utf8', - ), - 'ascii' => array( + ], + 'ascii' => [ ApiBase::PARAM_DFLT => false, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-ascii', - ), - 'formatversion' => array( - ApiBase::PARAM_TYPE => array( 1, 2, 'latest' ), + ], + 'formatversion' => [ + ApiBase::PARAM_TYPE => [ 1, 2, 'latest' ], ApiBase::PARAM_DFLT => 1, ApiBase::PARAM_HELP_MSG => 'apihelp-json-param-formatversion', - ), - ); + ], + ]; return $ret; } }