jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I9b6963df74125facbb3c3dea525320970d9212e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits