r80987 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80986‎ | r80987 | r80988 >
Date:20:37, 25 January 2011
Author:hashar
Status:reverted (Comments)
Tags:
Comment:
revert r80819 for now so we can use phpunit

function foo (Title $title = null ) {} does not work
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 $title, ParserOptions $options, $revid = null ) {
 457+ function preprocess( $text, $title, $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 $title, ParserOptions $options ) {
 477+ public function getPreloadText( $text, $title, $options ) {
478478 # Parser (re)initialisation
479479 $this->startExternalParse( $title, $options, self::OT_PLAIN, true );
480480
@@ -4293,7 +4293,7 @@
42944294 * Set up some variables which are usually set up in parse()
42954295 * so that an external function can call some class members with confidence
42964296 */
4297 - public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) {
 4297+ public function startExternalParse( &$title, $options, $outputType, $clearState = true ) {
42984298 $this->setTitle( $title );
42994299 $this->mOptions = $options;
43004300 $this->setOutputType( $outputType );
@@ -5187,7 +5187,7 @@
51885188 /**
51895189 * strip/replaceVariables/unstrip for preprocessor regression testing
51905190 */
5191 - function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
 5191+ function testSrvus( $text, $title, $options, $outputType = self::OT_HTML ) {
51925192 if ( !$title instanceof Title ) {
51935193 $title = Title::newFromText( $title );
51945194 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r81011Transforming a message uses automatically $wgTitle, which may not be set if r...platonides00:23, 26 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80819Add types to prototypes.platonides16:11, 23 January 2011

Comments

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

"function foo (Title $title = null ) {} does not work" seems a too bold statement. I checked it in php 5.1, php 5.2 and php 5.3 and that construct works as expected.

The problem in r80819 seem to be that preprocess() doesn't allow a null Title. Completely different than the construct "not working".

#Comment by Hashar (talk | contribs)   20:56, 26 January 2011

I am sorry about this comment Platonides. Should have investigated the issue a bit more or at least give more details.

Thanks for your explanation!

Status & tagging log