*
* @since 1.21
*
- * @param Content $content
+ * @param Content|null $content
*
* @throws MWException If the content is not an instance of TextContent and
* wgContentHandlerTextFallback was set to 'fail'.
*
* @param string $text The textual representation, will be
* unserialized to create the Content object
- * @param Title $title The title of the page this text belongs to.
+ * @param Title|null $title The title of the page this text belongs to.
* Required if $modelId is not provided.
- * @param string $modelId The model to deserialize to. If not provided,
+ * @param string|null $modelId The model to deserialize to. If not provided,
* $title->getContentModel() is used.
- * @param string $format The format to use for deserialization. If not
+ * @param string|null $format The format to use for deserialization. If not
* given, the model's default format is used.
*
* @throws MWException If model ID or format is not supported or if the text can not be
* @since 1.21
*
* @param Content $content The Content object to serialize
- * @param string $format The desired serialization format
+ * @param string|null $format The desired serialization format
*
* @return string Serialized form of the content
*/
* @since 1.21
*
* @param string $blob Serialized form of the content
- * @param string $format The format used for serialization
+ * @param string|null $format The format used for serialization
*
* @return Content The Content object created by deserializing $blob
*/
* @since 1.21
*
* @param Title $title The page to determine the language for.
- * @param Content $content The page's content, if you have it handy, to avoid reloading it.
+ * @param Content|null $content The page's content, if you have it handy, to avoid reloading it.
*
* @return Language The page's language
*/
* @since 1.21
*
* @param Title $title The page to determine the language for.
- * @param Content $content The page's content, if you have it handy, to avoid reloading it.
+ * @param Content|null $content The page's content, if you have it handy, to avoid reloading it.
*
* @return Language The page's language for viewing
*/
/**
* Get parser options suitable for rendering and caching the article
*
+ * @deprecated since 1.32, use WikiPage::makeParserOptions() or
+ * ParserOptions::newCanonical() instead.
* @param IContextSource|User|string $context One of the following:
* - IContextSource: Use the User and the Language of the provided
* context
* @return ParserOptions
*/
public function makeParserOptions( $context ) {
- global $wgContLang;
-
- if ( $context instanceof IContextSource ) {
- $user = $context->getUser();
- $lang = $context->getLanguage();
- } elseif ( $context instanceof User ) { // settings per user (even anons)
- $user = $context;
- $lang = null;
- } elseif ( $context === 'canonical' ) { // canonical settings
- $user = new User;
- $lang = $wgContLang;
- } else {
- throw new MWException( "Bad context for parser options: $context" );
- }
-
- return ParserOptions::newCanonical( $user, $lang );
+ wfDeprecated( __METHOD__, '1.32' );
+ return ParserOptions::newCanonical( $context );
}
/**
* Specific content handlers may override it if they need different content handling.
*
* @param WikiPage $page
- * @param ParserCache $cache
+ * @param ParserCache|null $cache
* @return ParserOutput
*/
public function getParserOutputForIndexing( WikiPage $page, ParserCache $cache = null ) {