Deprecate several public properties on the block classes
authorThalia <thalia.e.chan@googlemail.com>
Mon, 29 Jul 2019 20:10:27 +0000 (21:10 +0100)
committerThalia <thalia.e.chan@googlemail.com>
Mon, 29 Jul 2019 20:29:54 +0000 (21:29 +0100)
Public methods for checking and setting these properties already
exist where needed. Also update the remaining direct uses of these
properties in core.

Change-Id: Icdef025c9700e625aeb2a07975e69f1b1cc2466c

RELEASE-NOTES-1.34
includes/block/AbstractBlock.php
includes/block/DatabaseBlock.php
tests/phpunit/includes/Permissions/PermissionManagerTest.php

index 3e51f2d..1610637 100644 (file)
@@ -417,6 +417,11 @@ because of Phabricator reports.
   to be prevented. Modifying the $purgeBlobs parameter now has no effect.
 * SVGMetadataExtractor::getMetadata has been deprecated. Instead, you should
   use SVGReader->getMetadata() directly.
+* The following public properties on AbstractBlock are deprecated: $mReason,
+  $mTimestamp, $mExpiry, $mHideName. Use the getters/setters instead.
+* The following public properties on DatabaseBlock are deprecated: $mAuto,
+  $mParentBlockId. To check for an autoblock use DatabaseBlock::getType; to
+  check for the parent ID, use DatabaseBlock::getParentBlockId.
 
 === Other changes in 1.34 ===
 * …
index d24a2a5..f654404 100644 (file)
@@ -31,13 +31,22 @@ use User;
  * @since 1.34 Factored out from DatabaseBlock (previously Block).
  */
 abstract class AbstractBlock {
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getReason and setReason instead.
+        * @var string
+        */
        public $mReason;
 
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getTimestamp and setTimestamp instead.
+        * @var string
+        */
        public $mTimestamp;
 
-       /** @var string */
+       /**
+        * @deprecated since 1.34. Use getExpiry and setExpiry instead.
+        * @var string
+        */
        public $mExpiry = '';
 
        /** @var bool */
@@ -49,7 +58,10 @@ abstract class AbstractBlock {
        /** @var bool */
        protected $blockCreateAccount = false;
 
-       /** @var bool */
+       /**
+        * @deprecated since 1.34. Use getHideName and setHideName instead.
+        * @var bool
+        */
        public $mHideName = false;
 
        /** @var User|string */
index fbf9a07..2fd62ee 100644 (file)
@@ -53,10 +53,16 @@ use Wikimedia\Rdbms\IDatabase;
  * @since 1.34 Renamed from Block.
  */
 class DatabaseBlock extends AbstractBlock {
-       /** @var bool */
+       /**
+        * @deprecated since 1.34. Use getType to check whether a block is autoblocking.
+        * @var bool
+        */
        public $mAuto;
 
-       /** @var int */
+       /**
+        * @deprecated since 1.34. Use getParentBlockId instead.
+        * @var int
+        */
        public $mParentBlockId;
 
        /** @var int */
index 8a98217..8108639 100644 (file)
@@ -1161,7 +1161,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
                        'auto' => true,
                        'expiry' => 0
                ] );
-               $this->user->mBlock->mTimestamp = 0;
+               $this->user->mBlock->setTimestamp( 0 );
                $this->assertEquals( [ [ 'autoblockedtext',
                        "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
                        "\u{202A}Useruser\u{202C}", null, 'infinite', '127.0.8.1',