From: Thalia Date: Thu, 21 Mar 2019 14:34:48 +0000 (+0000) Subject: Remove deprecated handling of multiple arguments by the Block constructor X-Git-Tag: 1.34.0-rc.0~2431^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=b53095fc3687fdf79ca26293d35ea100a4be5da5;p=lhc%2Fweb%2Fwiklou.git Remove deprecated handling of multiple arguments by the Block constructor Also remove test for the deprecated functionality. Bug: T218892 Change-Id: I37ab858494a173c6982bb16bf1c362d5dd790e23 --- diff --git a/RELEASE-NOTES-1.33 b/RELEASE-NOTES-1.33 index 646a9c24f0..3cc32ccc31 100644 --- a/RELEASE-NOTES-1.33 +++ b/RELEASE-NOTES-1.33 @@ -331,6 +331,8 @@ because of Phabricator reports. Use ParserOutput::allCacheVaryingOptions instead. * CdnCacheUpdate::newSimplePurge, deprecated in 1.27, has been removed. Use CdnCacheUpdate::newFromTitles() instead. +* Handling of multiple arguments by the Block constructor, deprecated in 1.26, + has been removed. === Deprecations in 1.33 === * The configuration option $wgUseESI has been deprecated, and is expected diff --git a/includes/Block.php b/includes/Block.php index 65408f63a9..0693650238 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -148,14 +148,6 @@ class Block { 'sitewide' => true, ]; - if ( func_num_args() > 1 || !is_array( $options ) ) { - $options = array_combine( - array_slice( array_keys( $defaults ), 0, func_num_args() ), - func_get_args() - ); - wfDeprecated( __METHOD__ . ' with multiple arguments', '1.26' ); - } - $options += $defaults; $this->setTarget( $options['address'] ); diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index 1f11ef2665..50a4e2fee0 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -372,61 +372,6 @@ class BlockTest extends MediaWikiLangTestCase { $this->assertEquals( $exResult, $block->mReason, 'Correct block type for XFF header ' . $xff ); } - /** - * @covers Block::__construct - */ - public function testDeprecatedConstructor() { - $this->hideDeprecated( 'Block::__construct with multiple arguments' ); - $username = 'UnthinkablySecretRandomUsername'; - $reason = 'being irrational'; - - # Set up the target - $u = User::newFromName( $username ); - if ( $u->getId() == 0 ) { - $u->addToDatabase(); - TestUser::setPasswordForUser( $u, 'TotallyObvious' ); - } - unset( $u ); - - # Make sure the user isn't blocked - $this->assertNull( - Block::newFromTarget( $username ), - "$username should not be blocked" - ); - - # Perform the block - $block = new Block( - /* address */ $username, - /* user */ 0, - /* by */ $this->getTestSysop()->getUser()->getId(), - /* reason */ $reason, - /* timestamp */ 0, - /* auto */ false, - /* expiry */ 0 - ); - $block->insert(); - - # Check target - $this->assertEquals( - $block->getTarget()->getName(), - $username, - "Target should be set properly" - ); - - # Check supplied parameter - $this->assertEquals( - $block->mReason, - $reason, - "Reason should be non-default" - ); - - # Check default parameter - $this->assertFalse( - (bool)$block->appliesToRight( 'createaccount' ), - "Account creation should not be blocked by default" - ); - } - /** * @covers Block::getSystemBlockType * @covers Block::insert