Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/245984

Change subject: Remove not needed support for null in ChangeRow constructor
......................................................................

Remove not needed support for null in ChangeRow constructor

Change-Id: I9b6963df74125facbb3c3dea525320970d9212e8
---
M lib/includes/changes/ChangeRow.php
M lib/includes/changes/EntityChangeFactory.php
2 files changed, 6 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/84/245984/1

diff --git a/lib/includes/changes/ChangeRow.php 
b/lib/includes/changes/ChangeRow.php
index ad2058b..cdcd63b 100644
--- a/lib/includes/changes/ChangeRow.php
+++ b/lib/includes/changes/ChangeRow.php
@@ -65,11 +65,8 @@
                return false;
        }
 
-       /**
-        * @param array|null $fields
-        */
-       public function __construct( array $fields = null ) {
-               $this->setFields( is_array( $fields ) ? $fields : array() );
+       public function __construct( array $fields = array() ) {
+               $this->setFields( $fields );
 
                $this->postConstruct();
        }
diff --git a/lib/includes/changes/EntityChangeFactory.php 
b/lib/includes/changes/EntityChangeFactory.php
index 8f33f3e..ee32cc2 100644
--- a/lib/includes/changes/EntityChangeFactory.php
+++ b/lib/includes/changes/EntityChangeFactory.php
@@ -61,7 +61,7 @@
         *
         * @return EntityChange
         */
-       public function newForEntity( $action, EntityId $entityId, array 
$fields = null ) {
+       public function newForEntity( $action, EntityId $entityId, array 
$fields = array() ) {
                $entityType = $entityId->getEntityType();
 
                if ( isset( $this->changeClasses[ $entityType ] ) ) {
@@ -71,9 +71,7 @@
                }
 
                /** @var EntityChange $instance  */
-               $instance = new $class(
-                       $fields
-               );
+               $instance = new $class( $fields );
 
                if ( !$instance->hasField( 'object_id' ) ) {
                        $instance->setField( 'object_id', 
$entityId->getSerialization() );
@@ -99,7 +97,7 @@
         * @param string      $action The action name
         * @param EntityDocument|null $oldEntity
         * @param EntityDocument|null $newEntity
-        * @param array|null  $fields additional fields to set
+        * @param array $fields additional fields to set
         *
         * @return EntityChange
         * @throws MWException
@@ -108,7 +106,7 @@
                $action,
                EntityDocument $oldEntity = null,
                EntityDocument $newEntity = null,
-               array $fields = null
+               array $fields = array()
        ) {
                if ( $oldEntity === null && $newEntity === null ) {
                        throw new MWException( 'Either $oldEntity or $newEntity 
must be given' );

-- 
To view, visit https://gerrit.wikimedia.org/r/245984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b6963df74125facbb3c3dea525320970d9212e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to