Add AbstractBlock parent class for Block
authorThalia <thalia.e.chan@googlemail.com>
Tue, 7 May 2019 14:46:44 +0000 (09:46 -0500)
committerThalia <thalia.e.chan@googlemail.com>
Tue, 7 May 2019 16:23:46 +0000 (11:23 -0500)
This anticipates I83bceb5e5, which refactors Block into different
classes: Block (for blocks stored in the database), SystemBlock
(for temporary blocks), and AbstractBlock (the parent class).

Block should be become a deprecated alias of DatabaseBlock.

This adds an empty AbstractBlock parent class, and makes Block
extend AbstractBlock, but leaves it otherwise unchanged. This is
to allow typehints to be updated, to avoid a breaking change.

Bug: T222737
Change-Id: I3cf78cf77ccf492dadf53e479f81891961021469

includes/Block.php
includes/block/AbstractBlock.php [new file with mode: 0644]

index 0d13f7d..2479def 100644 (file)
 
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use MediaWiki\Block\AbstractBlock;
 use MediaWiki\Block\BlockRestrictionStore;
 use MediaWiki\Block\Restriction\Restriction;
 use MediaWiki\Block\Restriction\NamespaceRestriction;
 use MediaWiki\Block\Restriction\PageRestriction;
 use MediaWiki\MediaWikiServices;
 
-class Block {
+class Block extends AbstractBlock {
        /** @var string */
        public $mReason;
 
diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php
new file mode 100644 (file)
index 0000000..f432440
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+namespace MediaWiki\Block;
+
+/**
+ * @since 1.34
+ */
+abstract class AbstractBlock {
+}