From: daniel Date: Wed, 25 Apr 2012 16:34:36 +0000 (+0200) Subject: type hinting X-Git-Tag: 1.31.0-rc.0~22097^2^2~201 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=3518ceaad13d2a6a41b81765b0e7d6b6ffebede0;p=lhc%2Fweb%2Fwiklou.git type hinting --- diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index 401be9cf9e..d434a216fd 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -278,6 +278,7 @@ abstract class ContentHandler { /** * Creates an empty Content object of the type supported by this ContentHandler. * + * @return Content */ public abstract function makeEmptyContent(); @@ -294,7 +295,7 @@ abstract class ContentHandler { /** * Throws an MWException if $modelName is not the content model handeled by this ContentHandler. * - * @param $modelName the model name to check + * @param String $modelName the model name to check */ protected function checkModelName( $modelName ) { if ( $modelName !== $this->mModelName ) { @@ -331,7 +332,7 @@ abstract class ContentHandler { * Note that if $format is null, this method always returns true, because null * means "use the default format". * - * @param $format the serialization format to check + * @param String $format the serialization format to check * @return bool */ public function isSupportedFormat( $format ) { @@ -347,7 +348,7 @@ abstract class ContentHandler { * Throws an MWException if isSupportedFormat( $format ) is not true. Convenient * for checking whether a format provided as a parameter is actually supported. * - * @param $format the serialization format to check + * @param String $format the serialization format to check */ protected function checkFormat( $format ) { if ( !$this->isSupportedFormat( $format ) ) { @@ -475,8 +476,13 @@ abstract class ContentHandler { // Redirect autosummaries - $ot = !is_null( $oldContent ) ? $oldContent->getRedirectTarget() : false; - $rt = !is_null( $newContent ) ? $newContent->getRedirectTarget() : false; + /** + * @var $ot Title + * @var $rt Title + */ + + $ot = !is_null( $oldContent ) ? $oldContent->getRedirectTarget() : null; + $rt = !is_null( $newContent ) ? $newContent->getRedirectTarget() : null; if ( is_object( $rt ) && ( !is_object( $ot ) || !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) { @@ -643,7 +649,7 @@ abstract class ContentHandler { * Returns true for content models that support caching using the ParserCache mechanism. * See WikiPage::isParserCacheUser(). * - * @return book + * @return bool */ public function isParserCacheSupported() { return true; diff --git a/tests/phpunit/includes/WikitextContentHandlerTest.php b/tests/phpunit/includes/WikitextContentHandlerTest.php index 53c968f392..1ce8d45bfe 100644 --- a/tests/phpunit/includes/WikitextContentHandlerTest.php +++ b/tests/phpunit/includes/WikitextContentHandlerTest.php @@ -2,6 +2,9 @@ class WikitextContentHandlerTest extends MediaWikiTestCase { + /** + * @var ContentHandler + */ var $handler; public function setup() {