X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUsageException.php;h=47902a75b0a3cede6251c0023368f1b68baa1aca;hb=670c94ebf528155b9a9017784591e23ef57b9884;hp=7e21ab5ba446c227135ae5e7fd9e2e16042bb1c9;hpb=30f28501243ba58faf4063b701cf3148bd1d1280;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUsageException.php b/includes/api/ApiUsageException.php index 7e21ab5ba4..47902a75b0 100644 --- a/includes/api/ApiUsageException.php +++ b/includes/api/ApiUsageException.php @@ -45,6 +45,10 @@ class UsageException extends MWException { $this->mCodestr = $codestr; $this->mExtraData = $extradata; + if ( !$this instanceof ApiUsageException ) { + wfDeprecated( __METHOD__, '1.29' ); + } + // This should never happen, so throw an exception about it that will // hopefully get logged with a backtrace (T138585) if ( !is_string( $codestr ) || $codestr === '' ) { @@ -58,6 +62,7 @@ class UsageException extends MWException { * @return string */ public function getCodeString() { + wfDeprecated( __METHOD__, '1.29' ); return $this->mCodestr; } @@ -65,6 +70,7 @@ class UsageException extends MWException { * @return array */ public function getMessageArray() { + wfDeprecated( __METHOD__, '1.29' ); $result = [ 'code' => $this->mCodestr, 'info' => $this->getMessage() @@ -95,7 +101,7 @@ class UsageException extends MWException { * starts throwing ApiUsageException. Eventually UsageException will go away * and this will (probably) extend MWException directly. */ -class ApiUsageException extends UsageException { +class ApiUsageException extends UsageException implements ILocalizedException { protected $modulePath; protected $status; @@ -146,7 +152,7 @@ class ApiUsageException extends UsageException { } /** - * @returns ApiMessage + * @return ApiMessage */ private function getApiMessage() { $errors = $this->status->getErrorsByType( 'error' ); @@ -180,18 +186,20 @@ class ApiUsageException extends UsageException { /** * @deprecated Do not use. This only exists here because UsageException is in * the inheritance chain for backwards compatibility. - * @inheritdoc + * @inheritDoc */ public function getCodeString() { + wfDeprecated( __METHOD__, '1.29' ); return $this->getApiMessage()->getApiCode(); } /** * @deprecated Do not use. This only exists here because UsageException is in * the inheritance chain for backwards compatibility. - * @inheritdoc + * @inheritDoc */ public function getMessageArray() { + wfDeprecated( __METHOD__, '1.29' ); $enMsg = clone $this->getApiMessage(); $enMsg->inLanguage( 'en' )->useDatabase( false ); @@ -201,6 +209,13 @@ class ApiUsageException extends UsageException { ] + $enMsg->getApiData(); } + /** + * @inheritDoc + */ + public function getMessageObject() { + return $this->status->getMessage(); + } + /** * @return string */