jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/352096 )
Change subject: Use short array syntax [] everywhere
......................................................................
Use short array syntax [] everywhere
Patch mostly done with phpcbf, but then manually adjusted because phpcbf
inserted an extra space before some opening brackets.
Change-Id: I38d44826628e5c709eced6721a732953383ddbf0
---
M api/CheckConstraints.php
M includes/ConstraintCheck/Checker/CommonsLinkChecker.php
M includes/ConstraintCheck/Checker/ConflictsWithChecker.php
M includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
M includes/ConstraintCheck/Checker/FormatChecker.php
M includes/ConstraintCheck/Checker/InverseChecker.php
M includes/ConstraintCheck/Checker/ItemChecker.php
M includes/ConstraintCheck/Checker/MandatoryQualifiersChecker.php
M includes/ConstraintCheck/Checker/MultiValueChecker.php
M includes/ConstraintCheck/Checker/OneOfChecker.php
M includes/ConstraintCheck/Checker/QualifierChecker.php
M includes/ConstraintCheck/Checker/QualifiersChecker.php
M includes/ConstraintCheck/Checker/RangeChecker.php
M includes/ConstraintCheck/Checker/SingleValueChecker.php
M includes/ConstraintCheck/Checker/SymmetricChecker.php
M includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php
M includes/ConstraintCheck/Checker/TypeChecker.php
M includes/ConstraintCheck/Checker/UniqueValueChecker.php
M includes/ConstraintCheck/Checker/ValueTypeChecker.php
M includes/ConstraintCheck/DelegatingConstraintChecker.php
M includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
M includes/ConstraintCheck/Helper/ConstraintParameterParser.php
M includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php
M includes/ConstraintCheck/Result/CheckResult.php
M includes/ConstraintParameterRenderer.php
M includes/ConstraintReportFactory.php
M includes/ConstraintRepository.php
M maintenance/UpdateConstraintsTable.php
M phpcs.xml
M specials/SpecialConstraintReport.php
M tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
M tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php
M tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php
M tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php
M tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php
M tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php
M tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php
M tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php
M tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php
M tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php
M tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php
M tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
M tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php
M tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php
M tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php
M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php
M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php
M tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php
M tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php
M tests/phpunit/ConstraintReportFactoryTest.php
M tests/phpunit/ConstraintRepositoryTest.php
M tests/phpunit/DelegatingConstraintCheckerTest.php
M tests/phpunit/Helper/ConstraintParameterParserTest.php
M tests/phpunit/Result/CheckResultTest.php
M tests/phpunit/Specials/SpecialConstraintReportTest.php
55 files changed, 387 insertions(+), 389 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/api/CheckConstraints.php b/api/CheckConstraints.php
index 36236f3..9761df0 100644
--- a/api/CheckConstraints.php
+++ b/api/CheckConstraints.php
@@ -278,7 +278,7 @@
* @return array
*/
private function buildResult( array $checkResults, $entityIds = null ) {
- $constraintReport = array();
+ $constraintReport = [];
ApiResult::setArrayType( $constraintReport, 'assoc' );
// ensure that the report contains the given IDs even if there
are no results for them
@@ -300,12 +300,12 @@
'status' => $checkResult->getStatus(),
'property' =>
$checkResult->getPropertyId()->getSerialization(),
'claim' =>
$checkResult->getStatement()->getGuid(),
- 'constraint' => array(
+ 'constraint' => [
'id' => $checkResult->getConstraintId(),
'type' =>
$checkResult->getConstraintName(),
'detail' =>
$checkResult->getParameters(),
'detailHTML' =>
$this->constraintParameterRenderer->formatParameters(
$checkResult->getParameters() )
- )
+ ]
];
if ( $checkResult->getMessage() ) {
$result['message-html'] =
$checkResult->getMessage();
diff --git a/includes/ConstraintCheck/Checker/CommonsLinkChecker.php
b/includes/ConstraintCheck/Checker/CommonsLinkChecker.php
index 824c98b..b4205a7 100644
--- a/includes/ConstraintCheck/Checker/CommonsLinkChecker.php
+++ b/includes/ConstraintCheck/Checker/CommonsLinkChecker.php
@@ -40,7 +40,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$namespace = '';
if ( array_key_exists( 'namespace', $constraintParameters ) ) {
@@ -114,7 +114,7 @@
$dbConnection = $dbLoadBalancer->getConnection(
DB_REPLICA, false, $commonsWikiId );
$row = $dbConnection->selectRow(
- 'image', '*', array( 'img_name' => $commonsLink ) );
+ 'image', '*', [ 'img_name' => $commonsLink ] );
return $row ? true : false;
}
@@ -125,7 +125,7 @@
* @return bool
*/
private function commonsLinkIsWellFormed( $commonsLink ) {
- $toReplace = array ( "_", ":", "%20" );
+ $toReplace = [ "_", ":", "%20" ];
$compareString = trim( str_replace( $toReplace, '',
$commonsLink ) );
return $commonsLink === $compareString;
}
diff --git a/includes/ConstraintCheck/Checker/ConflictsWithChecker.php
b/includes/ConstraintCheck/Checker/ConflictsWithChecker.php
index 5671dcb..a206baa 100644
--- a/includes/ConstraintCheck/Checker/ConflictsWithChecker.php
+++ b/includes/ConstraintCheck/Checker/ConflictsWithChecker.php
@@ -55,7 +55,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
/*
diff --git a/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
b/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
index 3b2aee6..702f0ca 100644
--- a/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
+++ b/includes/ConstraintCheck/Checker/DiffWithinRangeChecker.php
@@ -48,7 +48,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$property = false;
if ( array_key_exists( 'property', $constraintParameters ) ) {
diff --git a/includes/ConstraintCheck/Checker/FormatChecker.php
b/includes/ConstraintCheck/Checker/FormatChecker.php
index ce6b7e8..c1eae22 100644
--- a/includes/ConstraintCheck/Checker/FormatChecker.php
+++ b/includes/ConstraintCheck/Checker/FormatChecker.php
@@ -40,7 +40,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
if ( array_key_exists( 'pattern', $constraintParameters ) ) {
diff --git a/includes/ConstraintCheck/Checker/InverseChecker.php
b/includes/ConstraintCheck/Checker/InverseChecker.php
index 92d14d8..7fdf390 100644
--- a/includes/ConstraintCheck/Checker/InverseChecker.php
+++ b/includes/ConstraintCheck/Checker/InverseChecker.php
@@ -57,7 +57,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
if ( array_key_exists( 'property', $constraintParameters ) ) {
diff --git a/includes/ConstraintCheck/Checker/ItemChecker.php
b/includes/ConstraintCheck/Checker/ItemChecker.php
index d6e988f..9de09f0 100644
--- a/includes/ConstraintCheck/Checker/ItemChecker.php
+++ b/includes/ConstraintCheck/Checker/ItemChecker.php
@@ -55,7 +55,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$property = false;
diff --git a/includes/ConstraintCheck/Checker/MandatoryQualifiersChecker.php
b/includes/ConstraintCheck/Checker/MandatoryQualifiersChecker.php
index d29471a..ff20dd4 100644
--- a/includes/ConstraintCheck/Checker/MandatoryQualifiersChecker.php
+++ b/includes/ConstraintCheck/Checker/MandatoryQualifiersChecker.php
@@ -40,16 +40,16 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
- $properties = array();
+ $properties = [];
if ( array_key_exists( 'property', $constraintParameters ) ) {
$properties = explode( ',',
$constraintParameters['property'] );
}
$parameters['property'] = $this->helper->parseParameterArray(
$properties );
$qualifiersList = $statement->getQualifiers();
- $qualifiers = array ();
+ $qualifiers = [];
/** @var Snak $qualifier */
foreach ( $qualifiersList as $qualifier ) {
diff --git a/includes/ConstraintCheck/Checker/MultiValueChecker.php
b/includes/ConstraintCheck/Checker/MultiValueChecker.php
index de26cce..f8a2ceb 100644
--- a/includes/ConstraintCheck/Checker/MultiValueChecker.php
+++ b/includes/ConstraintCheck/Checker/MultiValueChecker.php
@@ -38,7 +38,7 @@
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
$propertyId = $statement->getPropertyId();
- $parameters = array ();
+ $parameters = [];
$propertyCountArray =
$this->valueCountCheckerHelper->getPropertyCount( $entity->getStatements() );
diff --git a/includes/ConstraintCheck/Checker/OneOfChecker.php
b/includes/ConstraintCheck/Checker/OneOfChecker.php
index 685ee11..8346674 100644
--- a/includes/ConstraintCheck/Checker/OneOfChecker.php
+++ b/includes/ConstraintCheck/Checker/OneOfChecker.php
@@ -41,7 +41,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$items = false;
diff --git a/includes/ConstraintCheck/Checker/QualifierChecker.php
b/includes/ConstraintCheck/Checker/QualifierChecker.php
index 857d6b1..0ced8f0 100644
--- a/includes/ConstraintCheck/Checker/QualifierChecker.php
+++ b/includes/ConstraintCheck/Checker/QualifierChecker.php
@@ -41,7 +41,7 @@
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
$message = wfMessage( "wbqc-violation-message-qualifier"
)->escaped();
- return new CheckResult( $entity->getId(), $statement,
$constraint->getConstraintTypeQid(), $constraint->getConstraintId(), array (),
CheckResult::STATUS_VIOLATION, $message );
+ return new CheckResult( $entity->getId(), $statement,
$constraint->getConstraintTypeQid(), $constraint->getConstraintId(), [],
CheckResult::STATUS_VIOLATION, $message );
}
}
diff --git a/includes/ConstraintCheck/Checker/QualifiersChecker.php
b/includes/ConstraintCheck/Checker/QualifiersChecker.php
index 2b8b3ff..0d017bc 100644
--- a/includes/ConstraintCheck/Checker/QualifiersChecker.php
+++ b/includes/ConstraintCheck/Checker/QualifiersChecker.php
@@ -42,7 +42,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$parameters['property'] = $this->helper->parseParameterArray(
explode( ',', $constraintParameters['property'] ) );
diff --git a/includes/ConstraintCheck/Checker/RangeChecker.php
b/includes/ConstraintCheck/Checker/RangeChecker.php
index f5d07f5..e78cf4d 100644
--- a/includes/ConstraintCheck/Checker/RangeChecker.php
+++ b/includes/ConstraintCheck/Checker/RangeChecker.php
@@ -48,7 +48,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
if ( array_key_exists( 'constraint_status',
$constraintParameters ) ) {
diff --git a/includes/ConstraintCheck/Checker/SingleValueChecker.php
b/includes/ConstraintCheck/Checker/SingleValueChecker.php
index 5ae9b70..3c0c0b8 100644
--- a/includes/ConstraintCheck/Checker/SingleValueChecker.php
+++ b/includes/ConstraintCheck/Checker/SingleValueChecker.php
@@ -38,7 +38,7 @@
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
$propertyId = $statement->getPropertyId();
- $parameters = array ();
+ $parameters = [];
$propertyCountArray =
$this->valueCountCheckerHelper->getPropertyCount( $entity->getStatements() );
diff --git a/includes/ConstraintCheck/Checker/SymmetricChecker.php
b/includes/ConstraintCheck/Checker/SymmetricChecker.php
index 6ab2254..8342ba6 100644
--- a/includes/ConstraintCheck/Checker/SymmetricChecker.php
+++ b/includes/ConstraintCheck/Checker/SymmetricChecker.php
@@ -57,7 +57,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
if ( array_key_exists( 'constraint_status',
$constraintParameters ) ) {
diff --git a/includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php
b/includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php
index 251c510..7befede 100644
--- a/includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php
+++ b/includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php
@@ -57,7 +57,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$property = false;
diff --git a/includes/ConstraintCheck/Checker/TypeChecker.php
b/includes/ConstraintCheck/Checker/TypeChecker.php
index 29ae4e0..425c061 100644
--- a/includes/ConstraintCheck/Checker/TypeChecker.php
+++ b/includes/ConstraintCheck/Checker/TypeChecker.php
@@ -63,7 +63,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$classes = false;
diff --git a/includes/ConstraintCheck/Checker/UniqueValueChecker.php
b/includes/ConstraintCheck/Checker/UniqueValueChecker.php
index 3f56e09..907b68e 100644
--- a/includes/ConstraintCheck/Checker/UniqueValueChecker.php
+++ b/includes/ConstraintCheck/Checker/UniqueValueChecker.php
@@ -38,7 +38,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$message = wfMessage(
"wbqc-violation-message-not-yet-implemented" )->params(
$constraint->getConstraintTypeName() )->escaped();
return new CheckResult( $entity->getId(), $statement,
$constraint->getConstraintTypeQid(), $constraint->getConstraintId(),
$parameters, CheckResult::STATUS_TODO, $message );
diff --git a/includes/ConstraintCheck/Checker/ValueTypeChecker.php
b/includes/ConstraintCheck/Checker/ValueTypeChecker.php
index dfde8fa..4430d24 100644
--- a/includes/ConstraintCheck/Checker/ValueTypeChecker.php
+++ b/includes/ConstraintCheck/Checker/ValueTypeChecker.php
@@ -65,7 +65,7 @@
* @return CheckResult
*/
public function checkConstraint( Statement $statement, Constraint
$constraint, EntityDocument $entity ) {
- $parameters = array ();
+ $parameters = [];
$constraintParameters = $constraint->getConstraintParameters();
$classes = false;
diff --git a/includes/ConstraintCheck/DelegatingConstraintChecker.php
b/includes/ConstraintCheck/DelegatingConstraintChecker.php
index 55220fd..debdca9 100644
--- a/includes/ConstraintCheck/DelegatingConstraintChecker.php
+++ b/includes/ConstraintCheck/DelegatingConstraintChecker.php
@@ -138,7 +138,7 @@
* @return CheckResult[]
*/
private function checkEveryStatement( EntityDocument $entity,
$constraintIds = null ) {
- $result = array ();
+ $result = [];
/** @var Statement $statement */
foreach ( $this->statements as $statement ) {
@@ -158,7 +158,7 @@
* @return CheckResult[]
*/
private function checkStatement( EntityDocument $entity, Statement
$statement, $constraintIds = null ) {
- $result = array();
+ $result = [];
if ( $statement->getMainSnak()->getType() !== 'value' ) {
// skip 'somevalue' and 'novalue' cases, todo: handle
in a better way
@@ -260,7 +260,7 @@
}
$sortFunction = function ( CheckResult $a, CheckResult $b ) {
- $order = array ( 'other' => 4, 'compliance' => 3,
'exception' => 2, 'violation' => 1 );
+ $order = [ 'other' => 4, 'compliance' => 3, 'exception'
=> 2, 'violation' => 1 ];
$statusA = $a->getStatus();
$statusB = $b->getStatus();
diff --git a/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
b/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
index 32f6289..cb204df 100644
--- a/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
+++ b/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
@@ -52,7 +52,7 @@
foreach ( $statementList as $statement ) {
if ( $statement->getPropertyId()->getSerialization()
=== $propertyIdSerialization ) {
if ( is_string( $itemIdSerializationOrArray ) )
{ // string
- $itemIdSerializationArray = array (
$itemIdSerializationOrArray );
+ $itemIdSerializationArray = [
$itemIdSerializationOrArray ];
} else { // array
$itemIdSerializationArray =
$itemIdSerializationOrArray;
}
diff --git a/includes/ConstraintCheck/Helper/ConstraintParameterParser.php
b/includes/ConstraintCheck/Helper/ConstraintParameterParser.php
index 2ebafd0..d8a72b0 100644
--- a/includes/ConstraintCheck/Helper/ConstraintParameterParser.php
+++ b/includes/ConstraintCheck/Helper/ConstraintParameterParser.php
@@ -52,7 +52,7 @@
* @return array
*/
public function parseSingleParameter( $parameter, $asString = false ) {
- return array ( $this->parseParameter( $parameter, $asString ) );
+ return [ $this->parseParameter( $parameter, $asString ) ];
}
/**
@@ -65,9 +65,9 @@
*/
public function parseParameterArray( $parameterArray, $asString = false
) {
if ( $parameterArray[ 0 ] === '' ) { // parameter not given
- return array ( wfMessage(
"wbqc-constraintreport-no-parameter" )->escaped() );
+ return [ wfMessage(
"wbqc-constraintreport-no-parameter" )->escaped() ];
} else {
- $array = array ();
+ $array = [];
foreach ( $parameterArray as $parameter ) {
$array[] = $this->parseParameter( $parameter,
$asString );
}
diff --git a/includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php
b/includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php
index bc52968..ca9982f 100644
--- a/includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php
+++ b/includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php
@@ -26,7 +26,7 @@
*/
public function getPropertyCount( StatementList $statements ) {
if ( !isset( $this->propertyCount ) ) {
- $this->propertyCount = array ();
+ $this->propertyCount = [];
/** @var Statement $statement */
foreach ( $statements as $statement ) {
diff --git a/includes/ConstraintCheck/Result/CheckResult.php
b/includes/ConstraintCheck/Result/CheckResult.php
index c7c9c7c..a824f7f 100644
--- a/includes/ConstraintCheck/Result/CheckResult.php
+++ b/includes/ConstraintCheck/Result/CheckResult.php
@@ -69,7 +69,7 @@
* @param string $status
* @param string $message (sanitized HTML)
*/
- public function __construct( EntityId $entityId, Statement $statement,
$constraintName, $constraintId, $parameters = array (), $status =
self::STATUS_TODO, $message = '' ) {
+ public function __construct( EntityId $entityId, Statement $statement,
$constraintName, $constraintId, $parameters = [], $status = self::STATUS_TODO,
$message = '' ) {
$this->entityId = $entityId;
$this->statement = $statement;
$this->constraintName = $constraintName;
diff --git a/includes/ConstraintParameterRenderer.php
b/includes/ConstraintParameterRenderer.php
index 6d68fa5..d2fa983 100644
--- a/includes/ConstraintParameterRenderer.php
+++ b/includes/ConstraintParameterRenderer.php
@@ -87,7 +87,7 @@
return $this->formatValue( $value );
};
- $formattedParameters = array();
+ $formattedParameters = [];
foreach ( $parameters as $parameterName => $parameterValue ) {
$formattedParameterValues = implode( ', ',
$this->limitArrayLength( array_map(
$valueFormatter, $parameterValue ) ) );
diff --git a/includes/ConstraintReportFactory.php
b/includes/ConstraintReportFactory.php
index 7ad67b4..46d1987 100644
--- a/includes/ConstraintReportFactory.php
+++ b/includes/ConstraintReportFactory.php
@@ -120,7 +120,7 @@
$rangeCheckerHelper = new RangeCheckerHelper();
$typeCheckerHelper = new TypeCheckerHelper(
$this->lookup, $this->config );
- $this->constraintCheckerMap = array(
+ $this->constraintCheckerMap = [
'Conflicts with' => new ConflictsWithChecker(
$this->lookup, $constraintParameterParser, $connectionCheckerHelper ),
'Item' => new ItemChecker( $this->lookup,
$constraintParameterParser, $connectionCheckerHelper ),
'Target required claim' => new
TargetRequiredClaimChecker( $this->lookup, $constraintParameterParser,
$connectionCheckerHelper ),
@@ -139,7 +139,7 @@
'Format' => new FormatChecker(
$constraintParameterParser ),
'Commons link' => new CommonsLinkChecker(
$constraintParameterParser ),
'One of' => new OneOfChecker(
$constraintParameterParser ),
- );
+ ];
}
return $this->constraintCheckerMap;
@@ -150,26 +150,26 @@
*/
public function getConstraintParameterMap() {
if ( $this->constraintParameterMap === null ) {
- $this->constraintParameterMap = array(
- 'Commons link' => array( 'namespace' ),
- 'Conflicts with' => array( 'property', 'item' ),
- 'Diff within range' => array( 'property',
'minimum_quantity', 'maximum_quantity' ),
- 'Format' => array( 'pattern' ),
- 'Inverse' => array( 'property' ),
- 'Item' => array( 'property', 'item' ),
- 'Mandatory qualifiers' => array( 'property' ),
- 'Multi value' => array(),
- 'One of' => array( 'item' ),
- 'Qualifier' => array(),
- 'Qualifiers' => array( 'property' ),
- 'Range' => array( 'minimum_quantity',
'maximum_quantity', 'minimum_date', 'maximum_date' ),
- 'Single value' => array(),
- 'Symmetric' => array(),
- 'Target required claim' => array( 'property',
'item' ),
- 'Type' => array( 'class', 'relation' ),
- 'Unique value' => array(),
- 'Value type' => array( 'class', 'relation' )
- );
+ $this->constraintParameterMap = [
+ 'Commons link' => [ 'namespace' ],
+ 'Conflicts with' => [ 'property', 'item' ],
+ 'Diff within range' => [ 'property',
'minimum_quantity', 'maximum_quantity' ],
+ 'Format' => [ 'pattern' ],
+ 'Inverse' => [ 'property' ],
+ 'Item' => [ 'property', 'item' ],
+ 'Mandatory qualifiers' => [ 'property' ],
+ 'Multi value' => [],
+ 'One of' => [ 'item' ],
+ 'Qualifier' => [],
+ 'Qualifiers' => [ 'property' ],
+ 'Range' => [ 'minimum_quantity',
'maximum_quantity', 'minimum_date', 'maximum_date' ],
+ 'Single value' => [],
+ 'Symmetric' => [],
+ 'Target required claim' => [ 'property', 'item'
],
+ 'Type' => [ 'class', 'relation' ],
+ 'Unique value' => [],
+ 'Value type' => [ 'class', 'relation' ]
+ ];
}
return $this->constraintParameterMap;
diff --git a/includes/ConstraintRepository.php
b/includes/ConstraintRepository.php
index 9a9e7e3..1a75d82 100644
--- a/includes/ConstraintRepository.php
+++ b/includes/ConstraintRepository.php
@@ -26,7 +26,7 @@
$results = $db->select(
CONSTRAINT_TABLE,
'*',
- array( 'pid' => $propertyId->getNumericId() )
+ [ 'pid' => $propertyId->getNumericId() ]
);
return $this->convertToConstraints( $results );
@@ -41,12 +41,12 @@
public function insertBatch( array $constraints ) {
$accumulator = array_map(
function ( Constraint $constraint ) {
- return array(
+ return [
'constraint_guid' =>
$constraint->getConstraintId(),
'pid' =>
$constraint->getPropertyId()->getNumericId(),
'constraint_type_qid' =>
$constraint->getConstraintTypeQid(),
'constraint_parameters' => json_encode(
$constraint->getConstraintParameters(), JSON_FORCE_OBJECT )
- );
+ ];
},
$constraints
);
@@ -114,7 +114,7 @@
* @return Constraint[]
*/
private function convertToConstraints( ResultWrapper $results ) {
- $constraints = array();
+ $constraints = [];
foreach ( $results as $result ) {
$constraintTypeQid = $result->constraint_type_qid;
$constraintParameters = (array) json_decode(
$result->constraint_parameters );
diff --git a/maintenance/UpdateConstraintsTable.php
b/maintenance/UpdateConstraintsTable.php
index fedf913..f02c093 100644
--- a/maintenance/UpdateConstraintsTable.php
+++ b/maintenance/UpdateConstraintsTable.php
@@ -52,7 +52,7 @@
private function insertValues( ConstraintRepository $constraintRepo,
$csvFile ) {
$i = 0;
$db = wfGetDB( DB_MASTER );
- $accumulator = array();
+ $accumulator = [];
while ( true ) {
$data = fgetcsv( $csvFile );
@@ -67,7 +67,7 @@
$this->output( "$i rows inserted" );
}
- $accumulator = array();
+ $accumulator = [];
if ( $data === false ) {
if ( !$this->isQuiet() ) {
diff --git a/phpcs.xml b/phpcs.xml
index 332cd5e..f5cbe42 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Wikibase">
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase">
- <exclude name="Generic.Arrays.DisallowLongArraySyntax" />
-
<!-- FIXME: The following should all be fixed. -->
<exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis" />
<exclude name="PSR1.Classes.ClassDeclaration" />
diff --git a/specials/SpecialConstraintReport.php
b/specials/SpecialConstraintReport.php
index 2fb9100..c3b9358 100644
--- a/specials/SpecialConstraintReport.php
+++ b/specials/SpecialConstraintReport.php
@@ -165,7 +165,7 @@
* @return array
*/
private function getModules() {
- return array ( 'SpecialConstraintReportPage' );
+ return [ 'SpecialConstraintReportPage' ];
}
/**
@@ -256,16 +256,16 @@
* Builds html form for entity id input
*/
private function buildEntityIdForm() {
- $formDescriptor = array(
- 'entityid' => array(
+ $formDescriptor = [
+ 'entityid' => [
'class' => 'HTMLTextField',
'section' => 'section',
'name' => 'entityid',
'label-message' =>
'wbqc-constraintreport-form-entityid-label',
'cssclass' =>
'wbqc-constraintreport-form-entity-id',
'placeholder' => $this->msg(
'wbqc-constraintreport-form-entityid-placeholder' )->escaped()
- )
- );
+ ]
+ ];
$htmlForm = new HTMLForm( $formDescriptor, $this->getContext(),
'wbqc-constraintreport-form' );
$htmlForm->setSubmitText( $this->msg(
'wbqc-constraintreport-form-submit-label' )->escaped() );
$htmlForm->setSubmitCallback( function() {
@@ -301,9 +301,9 @@
return
Html::element(
'p',
- array (
+ [
'class' => $cssClasses
- ),
+ ],
$this->msg( $messageKey )->escaped()
);
}
@@ -313,11 +313,11 @@
*/
private function getExplanationText() {
return
- Html::openElement( 'div', array( 'class' =>
'wbqc-explanation') )
+ Html::openElement( 'div', [ 'class' =>
'wbqc-explanation' ] )
. $this->msg(
'wbqc-constraintreport-explanation-part-one' )->escaped()
. Html::closeElement( 'div' )
. Html::element( 'br' )
- . Html::openElement( 'div', array( 'class' =>
'wbqc-explanation') )
+ . Html::openElement( 'div', [ 'class' =>
'wbqc-explanation' ] )
. $this->msg(
'wbqc-constraintreport-explanation-part-two' )->escaped()
. Html::closeElement( 'div' );
}
@@ -343,7 +343,7 @@
private function buildResultTable( EntityId $entityId, array $results )
{
// Set table headers
$table = new HtmlTableBuilder(
- array (
+ [
new HtmlTableHeaderBuilder(
$this->msg(
'wbqc-constraintreport-result-table-header-status' )->escaped(),
true
@@ -356,7 +356,7 @@
$this->msg(
'wbqc-constraintreport-result-table-header-constraint' )->escaped(),
true
)
- )
+ ]
);
foreach ( $results as $result ) {
@@ -402,23 +402,23 @@
// Append cells
$table->appendRow(
- array (
+ [
new HtmlTableCellBuilder(
$statusColumn,
- array(),
+ [],
true
),
new HtmlTableCellBuilder(
$claimColumn,
- array(),
+ [],
true
),
new HtmlTableCellBuilder(
$constraintColumn,
- array(),
+ [],
true
)
- )
+ ]
);
return $table;
@@ -450,13 +450,13 @@
* @return string HTML
*/
protected function buildSummary( array $results ) {
- $statuses = array ();
+ $statuses = [];
foreach ( $results as $result ) {
$status = strtolower( $result->getStatus() );
$statuses[$status] = isset( $statuses[$status] ) ?
$statuses[$status] + 1 : 1;
}
- $statusElements = array ();
+ $statusElements = [];
foreach ( $statuses as $status => $count ) {
if ( $count > 0 ) {
$statusElements[] =
@@ -499,17 +499,17 @@
$tooltipIndicator = Html::element(
'span',
- array (
+ [
'class' => 'wbqc-indicator'
- ),
+ ],
$indicator
);
$tooltip = Html::rawElement(
'div',
- array (
+ [
'class' => 'wbqc-tooltip'
- ),
+ ],
$tooltipContent
);
@@ -547,17 +547,17 @@
$tooltipIndicator = Html::element(
'span',
- array (
+ [
'class' => 'wbqc-expandable-content-indicator
wbqc-indicator'
- ),
+ ],
$indicator
);
$expandableContent = Html::element(
'div',
- array(
+ [
'class' => 'wbqc-expandable-content'
- ),
+ ],
$expandableContent
);
@@ -580,9 +580,9 @@
$formattedStatus =
Html::element(
'span',
- array (
+ [
'class' => 'wbqc-status wbqc-status-' .
$status
- ),
+ ],
$this->msg( $messageName )->text()
);
@@ -601,12 +601,12 @@
*/
protected function formatDataValues( $dataValues, $separator = ', ' ) {
if ( $dataValues instanceof DataValue ) {
- $dataValues = array ( $dataValues );
+ $dataValues = [ $dataValues ];
} elseif ( !is_array( $dataValues ) ) {
throw new InvalidArgumentException( '$dataValues has to
be instance of DataValue or an array of DataValues.' );
}
- $formattedDataValues = array ();
+ $formattedDataValues = [];
foreach ( $dataValues as $dataValue ) {
if ( !( $dataValue instanceof DataValue ) ) {
throw new InvalidArgumentException(
'$dataValues has to be instance of DataValue or an array of DataValues.' );
@@ -634,10 +634,10 @@
return
Html::rawElement(
'a',
- array (
+ [
'href' => $this->getClaimUrl(
$entityId, $propertyId ),
'target' => '_blank'
- ),
+ ],
$text
);
}
diff --git
a/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
b/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
index 12f6455..940ad02 100644
--- a/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
+++ b/tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php
@@ -56,7 +56,7 @@
public function addDBData() {
$this->db->delete('image', '*');
- $this->db->insert('image', array(
+ $this->db->insert('image', [
'img_name' => 'test_image.jpg',
'img_size' => '42',
'img_width' => '7',
@@ -70,7 +70,7 @@
'img_user_text' => 'yomamma',
'img_timestamp' => '201501010000',
'img_sha1' =>
'8843d7f92416211de9ebb963ff4ce28125932878'
- )
+ ]
);
}
diff --git
a/tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php
b/tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php
index 8109f08..7bfce10 100644
--- a/tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php
@@ -68,9 +68,9 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
@@ -83,9 +83,9 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
@@ -98,10 +98,10 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'item' => 'Q1',
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
@@ -114,10 +114,10 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'item' => 'Q42',
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
@@ -130,7 +130,7 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement(new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
@@ -143,10 +143,10 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'item' => 'Q42',
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
diff --git
a/tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php
b/tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php
index a29e722..5808769 100644
--- a/tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php
@@ -39,7 +39,7 @@
parent::setUp();
$statement1 = new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q1' ) ) ) );
$statement2 = new Statement( new PropertyValueSnak( new
PropertyId( 'P2' ), new EntityIdValue( new ItemId( 'Q2' ) ) ) );
- $this->statementList = new StatementList( array( $statement1,
$statement2 ) );
+ $this->statementList = new StatementList( [ $statement1,
$statement2 ] );
$this->connectionCheckerHelper = new ConnectionCheckerHelper();
}
@@ -69,12 +69,12 @@
}
public function testHasClaimValidArray() {
- $this->assertEquals( true,
$this->connectionCheckerHelper->hasClaim( $this->statementList, 'P1', array(
'Q1', 'Q2' ) ) );
+ $this->assertEquals( true,
$this->connectionCheckerHelper->hasClaim( $this->statementList, 'P1', [ 'Q1',
'Q2' ] ) );
}
public function testHasClaimNoValueSnak() {
$statementList = new StatementList( new Statement( new
PropertyNoValueSnak( 1 ) ) );
- $this->assertEquals( false,
$this->connectionCheckerHelper->hasClaim( $statementList, 'P1', array( 'Q1',
'Q2' ) ) );
+ $this->assertEquals( false,
$this->connectionCheckerHelper->hasClaim( $statementList, 'P1', [ 'Q1', 'Q2' ]
) );
}
}
diff --git a/tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php
b/tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php
index 0d0ab92..9e0afa3 100644
--- a/tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php
@@ -70,9 +70,9 @@
$value = new EntityIdValue( new ItemId( 'Q7' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -83,9 +83,9 @@
$value = new EntityIdValue( new ItemId( 'Q8' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -96,7 +96,7 @@
$value = new EntityIdValue( new ItemId( 'Q7' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -107,9 +107,9 @@
$value = new StringValue( 'Q7' );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -120,9 +120,9 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -132,9 +132,9 @@
$statement = new Statement( new PropertyNoValueSnak( 1 ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php
b/tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php
index 60bef58..95131c2 100644
--- a/tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php
@@ -64,9 +64,9 @@
public function testItemConstraintInvalid() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
@@ -76,9 +76,9 @@
public function testItemConstraintProperty() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
@@ -89,10 +89,10 @@
public function testItemConstraintPropertyButNotItem() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2',
'item' => 'Q1'
- );
+ ];
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
@@ -103,10 +103,10 @@
public function testItemConstraintPropertyAndItem() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2',
'item' => 'Q42'
- );
+ ];
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
@@ -116,7 +116,7 @@
public function testItemConstraintWithoutProperty() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
diff --git a/tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php
b/tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php
index 9acb836..d7eed91 100644
--- a/tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php
@@ -115,7 +115,7 @@
->getMock();
$mock->expects( $this->any() )
->method( 'getConstraintParameters' )
- ->will( $this->returnValue( array() ) );
+ ->will( $this->returnValue( [] ) );
$mock->expects( $this->any() )
->method( 'getConstraintTypeQid' )
->will( $this->returnValue( 'Symmetric' ) );
diff --git
a/tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php
b/tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php
index 384901c..6e866ba 100644
--- a/tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php
+++ b/tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php
@@ -70,10 +70,10 @@
$value = new EntityIdValue( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2',
'item' => 'Q42'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -82,10 +82,10 @@
$value = new EntityIdValue( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2',
'item' => 'Q2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -94,9 +94,9 @@
$value = new EntityIdValue( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -105,9 +105,9 @@
$value = new EntityIdValue( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P3'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -116,7 +116,7 @@
$value = new EntityIdValue( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -125,9 +125,9 @@
$value = new StringValue( 'Q5' );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -136,9 +136,9 @@
$value = new EntityIdValue( new ItemId( 'Q100' ) );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P188' ), $value ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -146,9 +146,9 @@
public function testTargetRequiredClaimConstraintNoValueSnak() {
$statement = new Statement( new PropertyNoValueSnak( 1 ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P2'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git
a/tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php
b/tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php
index 4b0a84b..6f3681c 100644
--- a/tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php
+++ b/tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php
@@ -60,7 +60,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
$qualifierChecker = new MandatoryQualifiersChecker(
$this->helper );
- $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array(
'property' => 'P2' ) ), $entity );
+ $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [ 'property' =>
'P2' ] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -68,7 +68,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
$qualifierChecker = new MandatoryQualifiersChecker(
$this->helper );
- $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array(
'property' => 'P2,P3' ) ), $entity );
+ $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [ 'property' =>
'P2,P3' ] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php
b/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php
index b575d46..4af316e 100644
--- a/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php
+++ b/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php
@@ -60,7 +60,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
$qualifierChecker = new QualifierChecker( $this->helper );
- $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array() ),
$entity );
+ $checkResult = $qualifierChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php
b/tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php
index 38c89d7..aadd88c 100644
--- a/tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php
+++ b/tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php
@@ -67,7 +67,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q2' ) );
$qualifiersChecker = new QualifiersChecker( $this->helper );
- $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array(
'property' => $this->qualifiersList ) ), $entity );
+ $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [ 'property' =>
$this->qualifiersList ] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -75,7 +75,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q3' ) );
$qualifiersChecker = new QualifiersChecker( $this->helper );
- $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array(
'property' => $this->qualifiersList ) ), $entity );
+ $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [ 'property' =>
$this->qualifiersList ] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -83,7 +83,7 @@
/** @var Item $entity */
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
$qualifiersChecker = new QualifiersChecker( $this->helper );
- $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( array(
'property' => $this->qualifiersList ) ), $entity );
+ $checkResult = $qualifiersChecker->checkConstraint(
$this->getFirstStatement( $entity ), $this->getConstraintMock( [ 'property' =>
$this->qualifiersList ] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
diff --git a/tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php
b/tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php
index 9b329a4..52dbd0b 100644
--- a/tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php
+++ b/tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php
@@ -66,11 +66,11 @@
public function testDiffWithinRangeConstraintWithinRange() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P569',
'minimum_quantity' => 0,
'maximum_quantity' => 150
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P570' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -79,11 +79,11 @@
public function testDiffWithinRangeConstraintTooSmall() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P569',
'minimum_quantity' => 50,
'maximum_quantity' => 150
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P570' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -92,11 +92,11 @@
public function testDiffWithinRangeConstraintTooBig() {
$entity = $this->lookup->getEntity( new ItemId( 'Q6' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P569',
'minimum_quantity' => 0,
'maximum_quantity' => 150
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P570' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -105,7 +105,7 @@
public function testDiffWithinRangeConstraintWithoutProperty() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -114,9 +114,9 @@
public function testDiffWithinRangeConstraintWrongType() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1'
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new StringValue( '1.1.1970' ) ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -125,11 +125,11 @@
public function testDiffWithinRangeConstraintWrongTypeOfProperty() {
$entity = $this->lookup->getEntity( new ItemId( 'Q7' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P569',
'minimum_quantity' => 1,
'maximum_quantity' => 100
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P570' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -138,11 +138,11 @@
public function testDiffWithinRangeConstraintWithoutBaseProperty() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1000',
'minimum_quantity' => 0,
'maximum_quantity' => 150
- );
+ ];
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P570' ), $this->timeValue ) );
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
@@ -152,11 +152,11 @@
public function testDiffWithinRangeConstraintNoValueSnak() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
$statement = new Statement( new PropertyNoValueSnak( 1 ) );
- $constraintParameters = array(
+ $constraintParameters = [
'property' => 'P1000',
'minimum_quantity' => 0,
'maximum_quantity' => 150
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
b/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
index eb678a1..3238eb4 100644
--- a/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
+++ b/tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php
@@ -71,10 +71,10 @@
public function testRangeConstraintWithinRange() {
$value = new DecimalValue( 3.1415926536 );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new QuantityValue( $value, '1', $value, $value ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_quantity' => 0,
'maximum_quantity' => 10
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -82,10 +82,10 @@
public function testRangeConstraintTooSmall() {
$value = new DecimalValue( 42 );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new QuantityValue( $value, '1', $value, $value ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_quantity' => 100,
'maximum_quantity' => 1000
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -93,10 +93,10 @@
public function testRangeConstraintTooBig() {
$value = new DecimalValue( 3.141592 );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new QuantityValue( $value, '1', $value, $value ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_quantity' => 0,
'maximum_quantity' => 1
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -105,10 +105,10 @@
$min = '+00000001960-01-01T00:00:00Z';
$max = '+00000001980-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -117,10 +117,10 @@
$min = '+00000001960-01-01T00:00:00Z';
$max = 'now';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -129,10 +129,10 @@
$min = '1960';
$max = '1980';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -141,10 +141,10 @@
$min = '1969-12-31';
$max = '1970-01-02';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
@@ -153,10 +153,10 @@
$min = '+00000001975-01-01T00:00:00Z';
$max = '+00000001980-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -165,10 +165,10 @@
$min = '+00000001960-01-01T00:00:00Z';
$max = '+00000001965-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -178,10 +178,10 @@
$max = 42;
$value = new DecimalValue( 42 );
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new QuantityValue( $value, '1', $value, $value ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_quantity' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -190,10 +190,10 @@
$min = '+00000001970-01-01T00:00:00Z';
$max = 42;
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), $this->timeValue ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_quantity' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
@@ -202,17 +202,17 @@
$min = '+00000001960-01-01T00:00:00Z';
$max = '+00000001965-01-01T00:00:00Z';
$statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1457' ), new StringValue( '1.1.1970' ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'minimum_date' => $min,
'maximum_date' => $max
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testRangeConstraintNoValueSnak() {
$statement = new Statement( new PropertyNoValueSnak( 1 ) );
- $constraintParameters = array();
+ $constraintParameters = [];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php
b/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php
index 9dfd16c..ac9e7c7 100644
--- a/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php
+++ b/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php
@@ -46,34 +46,34 @@
public function testCheckHasClassInRelationValid() {
$statement1 = new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) );
$statement2 = new Statement( new PropertyValueSnak( new
PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q1' ) ) ) );
- $statements = new StatementList( array( $statement1,
$statement2 ) );
- $this->assertEquals( true, $this->helper->hasClassInRelation(
$statements, 'P31', array( 'Q1' ) ) );
+ $statements = new StatementList( [ $statement1, $statement2 ] );
+ $this->assertEquals( true, $this->helper->hasClassInRelation(
$statements, 'P31', [ 'Q1' ] ) );
}
public function testCheckHasClassInRelationInvalid() {
$statement1 = new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) );
$statement2 = new Statement( new PropertyValueSnak( new
PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q100' ) ) ) );
- $statements = new StatementList( array( $statement1,
$statement2 ) );
- $this->assertEquals( false, $this->helper->hasClassInRelation(
$statements, 'P31', array( 'Q1' ) ) );
+ $statements = new StatementList( [ $statement1, $statement2 ] );
+ $this->assertEquals( false, $this->helper->hasClassInRelation(
$statements, 'P31', [ 'Q1' ] ) );
}
public function testCheckHasClassInRelationValidWithIndirection() {
$statement1 = new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) );
$statement2 = new Statement( new PropertyValueSnak( new
PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q5' ) ) ) );
- $statements = new StatementList( array( $statement1,
$statement2 ) );
- $this->assertEquals( true, $this->helper->hasClassInRelation(
$statements, 'P31', array( 'Q4' ) ) );
+ $statements = new StatementList( [ $statement1, $statement2 ] );
+ $this->assertEquals( true, $this->helper->hasClassInRelation(
$statements, 'P31', [ 'Q4' ] ) );
}
public function testCheckIsSubclassOfValidWithIndirection() {
- $this->assertEquals( true, $this->helper->isSubclassOf( new
ItemId( 'Q6' ), array( 'Q100', 'Q101' ), 1) );
+ $this->assertEquals( true, $this->helper->isSubclassOf( new
ItemId( 'Q6' ), [ 'Q100', 'Q101' ], 1) );
}
public function testCheckIsSubclassOfInvalid() {
- $this->assertEquals( false, $this->helper->isSubclassOf( new
ItemId( 'Q6' ), array( 'Q200', 'Q201' ), 1) );
+ $this->assertEquals( false, $this->helper->isSubclassOf( new
ItemId( 'Q6' ), [ 'Q200', 'Q201' ], 1) );
}
public function testCheckIsSubclassCyclic() {
- $this->assertEquals( false, $this->helper->isSubclassOf( new
ItemId( 'Q7' ), array( 'Q100', 'Q101' ), 1) );
+ $this->assertEquals( false, $this->helper->isSubclassOf( new
ItemId( 'Q7' ), [ 'Q100', 'Q101' ], 1) );
}
}
diff --git a/tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php
b/tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php
index c825eb3..55ba88b 100644
--- a/tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php
+++ b/tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php
@@ -64,148 +64,148 @@
public function testTypeConstraintInstanceValid() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintInstanceValidWithIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q2' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintInstanceValidWithMoreIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q3' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintSubclassValid() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintSubclassValidWithIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintSubclassValidWithMoreIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q6' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testTypeConstraintInstanceInvalid() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintInstanceInvalidWithIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q2' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintInstanceInvalidWithMoreIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q3' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintSubclassInvalid() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201',
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintSubclassInvalidWithIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201' ,
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintSubclassInvalidWithMoreIndirection() {
$entity = $this->lookup->getEntity( new ItemId( 'Q6' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q200,Q201',
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintMissingRelation() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintMissingClass() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testTypeConstraintSubclassCycle() {
$entity = $this->lookup->getEntity( new ItemId( 'Q7' ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101',
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint(
$this->typeStatement, $this->getConstraintMock( $constraintParameters ),
$entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php
b/tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php
index 38ba0b5..45671fb 100644
--- a/tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php
+++ b/tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php
@@ -69,168 +69,168 @@
public function testValueTypeConstraintInstanceValid() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q1' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testValueTypeConstraintInstanceValidWithIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q2' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function
testValueTypeConstraintInstanceValidWithMoreIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q3' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testValueTypeConstraintSubclassValid() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q4' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testValueTypeConstraintSubclassValidWithIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q5' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function
testValueTypeConstraintSubclassValidWithMoreIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q6' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testValueTypeConstraintInstanceInvalid() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q1' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintInstanceInvalidWithIndirection()
{
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q2' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function
testValueTypeConstraintInstanceInvalidWithMoreIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q3' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintSubclassInvalid() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q4' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintSubclassInvalidWithIndirection()
{
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q5' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function
testValueTypeConstraintSubclassInvalidWithMoreIndirection() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q6' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'subclass',
'class' => 'Q200,Q201'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintMissingRelation() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q1' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintMissingClass() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q1' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintWrongType() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new StringValue( 'foo bar baz' ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintNonExistingValue() {
$statement = new Statement( new PropertyValueSnak(
$this->valueTypePropertyId, new EntityIdValue( new ItemId( 'Q100' ) ) ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testValueTypeConstraintNoValueSnak() {
$statement = new Statement( new PropertyNoValueSnak( 1 ) );
- $constraintParameters = array(
+ $constraintParameters = [
'relation' => 'instance',
'class' => 'Q100,Q101'
- );
+ ];
$checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( $constraintParameters ), $this->getEntity() );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php
b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php
index 1cd5dbd..793b90c 100644
--- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php
+++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php
@@ -64,21 +64,21 @@
public function testMultiValueConstraintOne() {
$entity = $this->lookup->getEntity( new ItemId( 'Q4' ) );
$statement = new Statement( new PropertyValueSnak(
$this->multiPropertyId, new EntityIdValue( new ItemId( 'Q207' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testMultiValueConstraintTwo() {
$entity = $this->lookup->getEntity( new ItemId( 'Q5' ) );
$statement = new Statement( new PropertyValueSnak(
$this->multiPropertyId, new EntityIdValue( new ItemId( 'Q207' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testMultiValueConstraintTwoButOneDeprecated() {
$entity = $this->lookup->getEntity( new ItemId( 'Q6' ) );
$statement = new Statement( new PropertyValueSnak(
$this->multiPropertyId, new EntityIdValue( new ItemId( 'Q409' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
diff --git a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php
b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php
index c9efc8f..117820e 100644
--- a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php
+++ b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php
@@ -64,21 +64,21 @@
public function testSingleValueConstraintOne() {
$entity = $this->lookup->getEntity( new ItemId( 'Q1' ) );
$statement = new Statement( new PropertyValueSnak(
$this->singlePropertyId, new EntityIdValue( new ItemId( 'Q1384' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
public function testSingleValueConstraintTwo() {
$entity = $this->lookup->getEntity( new ItemId( 'Q2' ) );
$statement = new Statement( new PropertyValueSnak(
$this->singlePropertyId, new EntityIdValue( new ItemId( 'Q1384' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'violation', $checkResult->getStatus(),
'check should not comply' );
}
public function testSingleValueConstraintTwoButOneDeprecated() {
$entity = $this->lookup->getEntity( new ItemId( 'Q3' ) );
$statement = new Statement( new PropertyValueSnak(
$this->singlePropertyId, new EntityIdValue( new ItemId( 'Q1384' ) ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
$this->assertEquals( 'compliance', $checkResult->getStatus(),
'check should comply' );
}
diff --git a/tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php
b/tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php
index 784cb2f..0f133b4 100644
--- a/tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php
+++ b/tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php
@@ -49,7 +49,7 @@
$itemId = new ItemId( 'Q404' );
$entity = new Item( $itemId );
$statement = new Statement( new PropertyValueSnak(
$this->uniquePropertyId, new EntityIdValue( $itemId ) ) );
- $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( array() ), $entity );
+ $checkResult = $this->checker->checkConstraint( $statement,
$this->getConstraintMock( [] ), $entity );
// TODO: It is currently only testing that 'todo' comes back.
$this->assertEquals( 'todo', $checkResult->getStatus(), 'check
should point out that it should be implemented soon' );
diff --git
a/tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php
b/tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php
index bddd8bd..7f2e8ef 100644
--- a/tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php
+++ b/tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php
@@ -33,7 +33,7 @@
$statement3 = new Statement( new PropertyValueSnak( new
PropertyId( 'P2' ), new EntityIdValue( new ItemId( 'Q3' ) ) ) );
$statement4 = new Statement( new PropertyValueSnak( new
PropertyId( 'P2' ), new EntityIdValue( new ItemId( 'Q4' ) ) ) );
$statement4->setRank( Statement::RANK_DEPRECATED );
- $this->statementList = new StatementList( array( $statement1,
$statement2, $statement3, $statement4 ) );
+ $this->statementList = new StatementList( [ $statement1,
$statement2, $statement3, $statement4 ] );
}
protected function tearDown() {
diff --git a/tests/phpunit/ConstraintReportFactoryTest.php
b/tests/phpunit/ConstraintReportFactoryTest.php
index e9aa12a..7bea87e 100644
--- a/tests/phpunit/ConstraintReportFactoryTest.php
+++ b/tests/phpunit/ConstraintReportFactoryTest.php
@@ -18,7 +18,7 @@
public function testGetMap() {
$map =
ConstraintReportFactory::getDefaultInstance()->getConstraintParameterMap();
- $this->assertEquals( array( 'pattern' ), $map['Format'] );
+ $this->assertEquals( [ 'pattern' ], $map['Format'] );
}
public function testGetDefaultInstance() {
diff --git a/tests/phpunit/ConstraintRepositoryTest.php
b/tests/phpunit/ConstraintRepositoryTest.php
index e9af2a7..1b84400 100644
--- a/tests/phpunit/ConstraintRepositoryTest.php
+++ b/tests/phpunit/ConstraintRepositoryTest.php
@@ -52,45 +52,45 @@
$this->assertSelect(
CONSTRAINT_TABLE,
- array(
+ [
'constraint_guid',
'pid',
'constraint_type_qid',
'constraint_parameters'
- ),
- array(),
- array(
- array (
+ ],
+ [],
+ [
+ [
'1',
1,
'Multi value',
'{}'
- ),
- array (
+ ],
+ [
'3',
1,
'Single value',
'{}'
- ),
- array (
+ ],
+ [
'bar',
'42',
'TestConstraint',
'{"bar":"baz"}'
- ),
- array (
+ ],
+ [
'baz',
'42',
'TestConstraint',
'{}'
- ),
- array (
+ ],
+ [
'foo',
'42',
'TestConstraint',
'{"foo":"bar"}'
- )
- )
+ ]
+ ]
);
}
@@ -103,10 +103,10 @@
$this->assertSelect(
CONSTRAINT_TABLE,
'COUNT(constraint_guid)',
- array(),
- array(
- array( 0 )
- )
+ [],
+ [
+ [ 0 ]
+ ]
);
}
diff --git a/tests/phpunit/DelegatingConstraintCheckerTest.php
b/tests/phpunit/DelegatingConstraintCheckerTest.php
index 8901eea..1102878 100644
--- a/tests/phpunit/DelegatingConstraintCheckerTest.php
+++ b/tests/phpunit/DelegatingConstraintCheckerTest.php
@@ -93,164 +93,164 @@
$this->db->insert(
CONSTRAINT_TABLE,
- array (
- array (
+ [
+ [
'constraint_guid' => '13',
'pid' => 1,
'constraint_type_qid' => 'Commons link',
'constraint_parameters' => json_encode(
- array ( 'namespace' => 'File' )
)
- ),
- array (
+ [ 'namespace' => 'File' ] )
+ ],
+ [
'constraint_guid' => '19',
'pid' => 10,
'constraint_type_qid' => 'Commons link',
'constraint_parameters' => json_encode(
- array (
+ [
'namespace' => 'File',
'known_exception' =>
'Q5'
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '20',
'pid' => 1,
'constraint_type_qid' => 'Mandatory
qualifiers',
'constraint_parameters' => json_encode(
- array ( 'property' => 'P2' ) )
- ),
- array (
+ [ 'property' => 'P2' ] )
+ ],
+ [
'constraint_guid' => '14',
'pid' => 1,
'constraint_type_qid' => 'Conflicts
with',
'constraint_parameters' => json_encode(
- array ( 'property' => 'P2' ) )
- ),
- array (
+ [ 'property' => 'P2' ] )
+ ],
+ [
'constraint_guid' => '15',
'pid' => 1,
'constraint_type_qid' => 'Inverse',
'constraint_parameters' => json_encode(
- array ( 'property' => 'P2' ) )
- ),
- array (
+ [ 'property' => 'P2' ] )
+ ],
+ [
'constraint_guid' => '16',
'pid' => 1,
'constraint_type_qid' => 'Qualifiers',
'constraint_parameters' => json_encode(
- array ( 'property' => 'P2,P3' )
)
- ),
- array (
+ [ 'property' => 'P2,P3' ] )
+ ],
+ [
'constraint_guid' => '17',
'pid' => 1,
'constraint_type_qid' => 'Diff within
range',
'constraint_parameters' => json_encode(
- array (
+ [
'property' => 'P2',
'minimum_quantity' => 0,
'maximum_quantity' =>
150
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '18',
'pid' => 1,
'constraint_type_qid' => 'Format',
'constraint_parameters' => json_encode(
- array ( 'pattern' => '[0-9]' ) )
- ),
- array (
+ [ 'pattern' => '[0-9]' ] )
+ ],
+ [
'constraint_guid' => '1',
'pid' => 1,
'constraint_type_qid' => 'Multi value',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '2',
'pid' => 1,
'constraint_type_qid' => 'Unique value',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '3',
'pid' => 1,
'constraint_type_qid' => 'Single value',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '4',
'pid' => 1,
'constraint_type_qid' => 'Symmetric',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '5',
'pid' => 1,
'constraint_type_qid' => 'Qualifier',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '6',
'pid' => 1,
'constraint_type_qid' => 'One of',
'constraint_parameters' => json_encode(
- array ( 'item' => 'Q2,Q3' ) )
- ),
- array (
+ [ 'item' => 'Q2,Q3' ] )
+ ],
+ [
'constraint_guid' => '7',
'pid' => 1,
'constraint_type_qid' => 'Range',
'constraint_parameters' => json_encode(
- array (
+ [
'minimum_quantity' => 0,
'maximum_quantity' =>
2015
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '8',
'pid' => 1,
'constraint_type_qid' => 'Target
required claim',
'constraint_parameters' => json_encode(
- array (
+ [
'property' => 'P2',
'item' => 'Q2'
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '9',
'pid' => 1,
'constraint_type_qid' => 'Item',
'constraint_parameters' => json_encode(
- array (
+ [
'property' => 'P2',
'item' => 'Q2,Q3'
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '10',
'pid' => 1,
'constraint_type_qid' => 'Type',
'constraint_parameters' => json_encode(
- array (
+ [
'class' => 'Q2,Q3',
'relation' => 'instance'
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '11',
'pid' => 1,
'constraint_type_qid' => 'Value type',
'constraint_parameters' => json_encode(
- array (
+ [
'class' => 'Q2,Q3',
'relation' => 'instance'
- ) )
- ),
- array (
+ ] )
+ ],
+ [
'constraint_guid' => '12',
'pid' => 3,
'constraint_type_qid' => 'Is not
inside',
'constraint_parameters' => '{}'
- )
- )
+ ]
+ ]
);
}
diff --git a/tests/phpunit/Helper/ConstraintParameterParserTest.php
b/tests/phpunit/Helper/ConstraintParameterParserTest.php
index f5333a2..e8a533f 100644
--- a/tests/phpunit/Helper/ConstraintParameterParserTest.php
+++ b/tests/phpunit/Helper/ConstraintParameterParserTest.php
@@ -33,35 +33,35 @@
public function testParseSingleParameter() {
$parameter = 'P1';
- $this->assertEquals( array( new PropertyId( $parameter ) ),
$this->helper->parseSingleParameter( $parameter ) );
+ $this->assertEquals( [ new PropertyId( $parameter ) ],
$this->helper->parseSingleParameter( $parameter ) );
}
public function testParseNullParameter() {
$parameter = null;
- $this->assertEquals( array( 'none' ),
$this->helper->parseSingleParameter( $parameter ) );
+ $this->assertEquals( [ 'none' ],
$this->helper->parseSingleParameter( $parameter ) );
}
public function testParseNullParameterArray() {
- $parameter = array( '' );
- $this->assertEquals( array( 'none' ),
$this->helper->parseParameterArray( $parameter ) );
+ $parameter = [ '' ];
+ $this->assertEquals( [ 'none' ],
$this->helper->parseParameterArray( $parameter ) );
}
public function testParseParameterArray() {
- $parameter = array ( 'Q1', 'Q2' );
- $this->assertEquals( array (
- new ItemId(
'Q1' ),
- new ItemId(
'Q2' )
- ),
$this->helper->parseParameterArray( $parameter ) );
+ $parameter = [ 'Q1', 'Q2' ];
+ $this->assertEquals( [
+ new ItemId( 'Q1' ),
+ new ItemId( 'Q2' )
+ ], $this->helper->parseParameterArray( $parameter ) );
}
public function testParseParameterString() {
$parameter = 'instance';
- $this->assertEquals( array ( 'instance' ),
$this->helper->parseSingleParameter( $parameter, true ) );
+ $this->assertEquals( [ 'instance' ],
$this->helper->parseSingleParameter( $parameter, true ) );
}
public function testParseParameterUnknownParameter() {
$parameter = 'R1';
- $this->assertEquals( array ( '' ),
$this->helper->parseSingleParameter( $parameter ) );
+ $this->assertEquals( [ '' ],
$this->helper->parseSingleParameter( $parameter ) );
}
}
diff --git a/tests/phpunit/Result/CheckResultTest.php
b/tests/phpunit/Result/CheckResultTest.php
index bbde763..d58ba28 100644
--- a/tests/phpunit/Result/CheckResultTest.php
+++ b/tests/phpunit/Result/CheckResultTest.php
@@ -63,7 +63,7 @@
$this->statement = new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new StringValue( 'Foo' ) ) );
$this->constraintName = 'Range';
$this->constraintId = '1';
- $this->parameters = array ();
+ $this->parameters = [];
$this->status = 'compliance';
$this->message = 'All right';
}
diff --git a/tests/phpunit/Specials/SpecialConstraintReportTest.php
b/tests/phpunit/Specials/SpecialConstraintReportTest.php
index 3fecd00..f6ad452 100644
--- a/tests/phpunit/Specials/SpecialConstraintReportTest.php
+++ b/tests/phpunit/Specials/SpecialConstraintReportTest.php
@@ -49,7 +49,7 @@
/**
* @var array
*/
- private static $claimGuids = array ();
+ private static $claimGuids = [];
/**
* @var bool
@@ -121,20 +121,20 @@
$this->db->insert(
CONSTRAINT_TABLE,
- array (
- array (
+ [
+ [
'constraint_guid' => '1',
'pid' => self::$idMap[ 'P1'
]->getNumericId(),
'constraint_type_qid' => 'Multi value',
'constraint_parameters' => '{}'
- ),
- array (
+ ],
+ [
'constraint_guid' => '3',
'pid' => self::$idMap[ 'P1'
]->getNumericId(),
'constraint_type_qid' => 'Single value',
'constraint_parameters' => '{}'
- )
- )
+ ]
+ ]
);
}
@@ -162,8 +162,8 @@
public function executeProvider() {
$userLanguage = 'qqx';
- $cases = array ();
- $matchers = array ();
+ $cases = [];
+ $matchers = [];
// Empty input
$matchers['explanationOne'] = both( withTagName( 'div' ) )
@@ -185,7 +185,7 @@
value="(wbqc-constraintreport-form-submit-label)"/>'
);
- $cases[ 'empty' ] = array ( '', array (), $userLanguage,
$matchers );
+ $cases[ 'empty' ] = [ '', [], $userLanguage, $matchers ];
// Invalid input
$matchers['error'] = both(
@@ -194,8 +194,8 @@
)
)->andAlso( havingTextContents(
'(wbqc-constraintreport-invalid-entity-id)' ) );
- $cases[ 'invalid input 1' ] = array ( 'Qwertz', array (),
$userLanguage, $matchers );
- $cases[ 'invalid input 2' ] = array ( '300', array (),
$userLanguage, $matchers );
+ $cases[ 'invalid input 1' ] = [ 'Qwertz', [], $userLanguage,
$matchers ];
+ $cases[ 'invalid input 2' ] = [ '300', [], $userLanguage,
$matchers ];
// Valid input but entity does not exist
unset( $matchers[ 'error' ] );
@@ -206,19 +206,19 @@
)
)->andAlso( havingTextContents(
'(wbqc-constraintreport-not-existent-entity)' ) );
- $cases[ 'valid input - not existing item' ] = array (
+ $cases[ 'valid input - not existing item' ] = [
self::NOT_EXISTENT_ITEM_ID,
- array (),
+ [],
$userLanguage,
$matchers
- );
+ ];
// Valid input and entity exists
unset( $matchers[ 'error' ] );
- $matchers[ 'result for' ] = array (
+ $matchers[ 'result for' ] = [
'tag' => 'h3',
'content' => '(wbqc-constraintreport-result-headline) '
- );
+ ];
$matchers['result for'] = both(
withTagName( 'h3' )
@@ -260,7 +260,7 @@
havingTextContents(
'(wbqc-constraintreport-status-compliance)' )
);
- $cases[ 'valid input - existing item' ] = array ( '$id', array
(), $userLanguage, $matchers );
+ $cases[ 'valid input - existing item' ] = [ '$id', [],
$userLanguage, $matchers ];
return $cases;
}
--
To view, visit https://gerrit.wikimedia.org/r/352096
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I38d44826628e5c709eced6721a732953383ddbf0
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits