r80819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80818‎ | r80819 | r80820 >
Date:16:11, 23 January 2011
Author:platonides
Status:reverted (Comments)
Tags:
Comment:
Add types to prototypes.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -453,7 +453,7 @@
454454 * Expand templates and variables in the text, producing valid, static wikitext.
455455 * Also removes comments.
456456 */
457 - function preprocess( $text, $title, $options, $revid = null ) {
 457+ function preprocess( $text, Title $title, ParserOptions $options, $revid = null ) {
458458 wfProfileIn( __METHOD__ );
459459 $this->startExternalParse( $title, $options, self::OT_PREPROCESS, true );
460460 if ( $revid !== null ) {
@@ -473,7 +473,7 @@
474474 * <noinclude>, <includeonly> etc. are parsed as for template transclusion,
475475 * comments, templates, arguments, tags hooks and parser functions are untouched.
476476 */
477 - public function getPreloadText( $text, $title, $options ) {
 477+ public function getPreloadText( $text, Title $title, ParserOptions $options ) {
478478 # Parser (re)initialisation
479479 $this->startExternalParse( $title, $options, self::OT_PLAIN, true );
480480
@@ -4288,7 +4288,7 @@
42894289 * Set up some variables which are usually set up in parse()
42904290 * so that an external function can call some class members with confidence
42914291 */
4292 - public function startExternalParse( &$title, $options, $outputType, $clearState = true ) {
 4292+ public function startExternalParse( Title $title, ParserOptions $options, $outputType, $clearState = true ) {
42934293 $this->setTitle( $title );
42944294 $this->mOptions = $options;
42954295 $this->setOutputType( $outputType );
@@ -5182,7 +5182,7 @@
51835183 /**
51845184 * strip/replaceVariables/unstrip for preprocessor regression testing
51855185 */
5186 - function testSrvus( $text, $title, $options, $outputType = self::OT_HTML ) {
 5186+ function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
51875187 if ( !$title instanceof Title ) {
51885188 $title = Title::newFromText( $title );
51895189 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r80987revert r80819 for now so we can use phpunit...hashar20:37, 25 January 2011
r81011Transforming a message uses automatically $wgTitle, which may not be set if r...platonides00:23, 26 January 2011

Comments

#Comment by RobertL (talk | contribs)   18:34, 25 January 2011

Getting the following error on an extension script that used to work fine: Catchable fatal error: Argument 2 passed to Parser::preprocess() must be an instance of Title, null given, called in /srv/web/local/mediawiki.devel.robert.users.local/www/w/includes/parser/Parser.php on line 4323 and defined in /srv/web/local/mediawiki.devel.robert.users.local/www/w/includes/parser/Parser.php on line 456

#Comment by Hashar (talk | contribs)   20:37, 25 January 2011

reverted with 80987 so we can use PHPUnit tests.

#Comment by Platonides (talk | contribs)   21:14, 25 January 2011

Which extension is it? Seems an extension problem, although sometimes the problem is that $wgTitle is null in phpunit.

Status & tagging log