X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FMessage.php;h=c1a12aa912c0cd29a698a543a8329dbe1c45befc;hb=9e831f0b4d5dd25144e1841eb46d632d2697de63;hp=2c979dedd0afdbbbab67693f6ee0f1f52f91a6f4;hpb=2ab61690b27a6fa0f4b81909cdd0709d9de38dbe;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 2c979dedd0..c1a12aa912 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -120,7 +120,7 @@ * * @code * // old style: - * wfMsgExt( 'key', array( 'parseinline' ), 'apple' ); + * wfMsgExt( 'key', [ 'parseinline' ], 'apple' ); * // new style: * wfMessage( 'key', 'apple' )->parse(); * @endcode @@ -131,7 +131,7 @@ * Places where HTML cannot be used. {{-transformation is done. * @code * // old style: - * wfMsgExt( 'key', array( 'parsemag' ), 'apple', 'pear' ); + * wfMsgExt( 'key', [ 'parsemag' ], 'apple', 'pear' ); * // new style: * wfMessage( 'key', 'apple', 'pear' )->text(); * @endcode @@ -852,6 +852,12 @@ class Message implements MessageSpecifier, Serializable { * @return string */ public function __toString() { + if ( $this->format !== 'parse' ) { + $ex = new LogicException( __METHOD__ . ' using implicit format: ' . $this->format ); + \MediaWiki\Logger\LoggerFactory::getInstance( 'message-format' )->warning( + $ex->getMessage(), [ 'exception' => $ex, 'format' => $this->format, 'key' => $this->key ] ); + } + // PHP doesn't allow __toString to throw exceptions and will // trigger a fatal error if it does. So, catch any exceptions.