Remove deprecated Article::__get/__set magic functions
Change-Id: If8e8006e88f11848f129ebfb10d5093d492287bb
This commit is contained in:
parent
50e365a675
commit
353fd0bbf4
3 changed files with 1 additions and 67 deletions
|
|
@ -182,6 +182,7 @@ because of Phabricator reports.
|
|||
- ::run()
|
||||
- ::runWithoutAbort()
|
||||
- ::runner()
|
||||
* Article::__get(), ::__set(), deprecated since 1.35, have been removed.
|
||||
* …
|
||||
|
||||
=== Deprecations in 1.42 ===
|
||||
|
|
|
|||
|
|
@ -1990,48 +1990,6 @@ class Article implements Page {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.35, use Article::getPage() instead
|
||||
*
|
||||
* Use PHP's magic __get handler to handle accessing of
|
||||
* raw WikiPage fields for backwards compatibility
|
||||
*
|
||||
* @param string $fname Field name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get( $fname ) {
|
||||
wfDeprecatedMsg( "Accessing Article::\$$fname is deprecated since MediaWiki 1.35",
|
||||
'1.35' );
|
||||
|
||||
if ( property_exists( $this->mPage, $fname ) ) {
|
||||
return $this->mPage->$fname;
|
||||
}
|
||||
trigger_error( 'Inaccessible property via __get(): ' . $fname, E_USER_NOTICE );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.35, use Article::getPage() instead
|
||||
*
|
||||
* Use PHP's magic __set handler to handle setting of
|
||||
* raw WikiPage fields for backwards compatibility
|
||||
*
|
||||
* @param string $fname Field name
|
||||
* @param mixed $fvalue New value
|
||||
*/
|
||||
public function __set( $fname, $fvalue ) {
|
||||
wfDeprecatedMsg( "Setting Article::\$$fname is deprecated since MediaWiki 1.35",
|
||||
'1.35' );
|
||||
|
||||
if ( property_exists( $this->mPage, $fname ) ) {
|
||||
$this->mPage->$fname = $fvalue;
|
||||
// Note: extensions may want to toss on new fields
|
||||
} elseif ( !in_array( $fname, [ 'mContext', 'mPage' ] ) ) {
|
||||
$this->mPage->$fname = $fvalue;
|
||||
} else {
|
||||
trigger_error( 'Inaccessible property via __set(): ' . $fname, E_USER_NOTICE );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to WikiPage function for backwards compatibility.
|
||||
* @see ContentHandler::getActionOverrides
|
||||
|
|
|
|||
|
|
@ -33,31 +33,6 @@ class ArticleTest extends \MediaWikiIntegrationTestCase {
|
|||
return $article;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Article::__get
|
||||
* @covers Article::__set
|
||||
*/
|
||||
public function testGetOrSetOnNewProperty() {
|
||||
$article = new Article( Title::newMainPage() );
|
||||
|
||||
$this->filterDeprecated(
|
||||
'/Accessing Article::\$ext_someNewProperty/'
|
||||
);
|
||||
$this->filterDeprecated(
|
||||
'/Setting Article::\$ext_someNewProperty/'
|
||||
);
|
||||
$article->ext_someNewProperty = 12;
|
||||
$this->assertEquals( 12, $article->ext_someNewProperty,
|
||||
"Article get/set magic on new field" );
|
||||
$this->assertEquals( 12, $article->getPage()->ext_someNewProperty,
|
||||
"Article get/set magic on new field" );
|
||||
$article->ext_someNewProperty = -8;
|
||||
$this->assertEquals( -8, $article->ext_someNewProperty,
|
||||
"Article get/set magic on update to new field" );
|
||||
$this->assertEquals( -8, $article->getPage()->ext_someNewProperty,
|
||||
"Article get/set magic on new field" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Article::__sleep
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue