jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/400572 )
Change subject: Add missing @param docs and such
......................................................................
Add missing @param docs and such
This also removes some redundant bits of text that do not add much to
whats already obvious from the variable name and the type.
Change-Id: I173b2c0e8fe5f56ff385b3389440a27130c60294
---
M src/ConstraintCheck/Context/ApiV2Context.php
M src/ConstraintCheck/Context/Context.php
M tests/phpunit/ConstraintParameters.php
M tests/phpunit/Fake/FakeSnakContext.php
4 files changed, 32 insertions(+), 21 deletions(-)
Approvals:
Lucas Werkmeister (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ConstraintCheck/Context/ApiV2Context.php
b/src/ConstraintCheck/Context/ApiV2Context.php
index b693b10..9a8a48f 100644
--- a/src/ConstraintCheck/Context/ApiV2Context.php
+++ b/src/ConstraintCheck/Context/ApiV2Context.php
@@ -24,17 +24,17 @@
/**
* Returns the statement subcontainer.
*
- * @param array &$container
- * @param string $entityId entity ID serialization
- * @param string $propertyId property ID serialization
- * @param string $statementId statement GUID
+ * @param array[] &$container
+ * @param string $entityId
+ * @param string $propertyId
+ * @param string $statementGuid
* @return array
*/
protected function &getStatementArray(
array &$container,
$entityId,
$propertyId,
- $statementId
+ $statementGuid
) {
if ( !array_key_exists( $entityId, $container ) ) {
$container[$entityId] = [];
@@ -52,13 +52,13 @@
$propertyContainer = &$claimsContainer[$propertyId];
foreach ( $propertyContainer as &$statement ) {
- if ( $statement['id'] === $statementId ) {
+ if ( $statement['id'] === $statementGuid ) {
$statementArray = &$statement;
break;
}
}
if ( !isset( $statementArray ) ) {
- $statementArray = [ 'id' => $statementId ];
+ $statementArray = [ 'id' => $statementGuid ];
$propertyContainer[] = &$statementArray;
}
@@ -70,11 +70,15 @@
* It should locate the array in $container or,
* if the array doesn’t exist yet, create it and emplace it there.
*
- * @param array &$container
+ * @param array[] &$container
* @return array
*/
abstract protected function &getMainArray( array &$container );
+ /**
+ * @param array|null $result
+ * @param array[] &$container
+ */
public function storeCheckResultInArray( $result, array &$container ) {
$mainArray = &$this->getMainArray( $container );
if ( !array_key_exists( 'results', $mainArray ) ) {
diff --git a/src/ConstraintCheck/Context/Context.php
b/src/ConstraintCheck/Context/Context.php
index 844bc8b..e36412f 100644
--- a/src/ConstraintCheck/Context/Context.php
+++ b/src/ConstraintCheck/Context/Context.php
@@ -84,7 +84,7 @@
* but still populate the appropriate location for this context in
$container.
*
* @param array|null $result
- * @param array &$container
+ * @param array[] &$container
*/
public function storeCheckResultInArray( $result, array &$container );
diff --git a/tests/phpunit/ConstraintParameters.php
b/tests/phpunit/ConstraintParameters.php
index b434b5e..59ef20f 100644
--- a/tests/phpunit/ConstraintParameters.php
+++ b/tests/phpunit/ConstraintParameters.php
@@ -87,7 +87,7 @@
/**
* @param string[] $classIds item ID serializations
- * @return array
+ * @return array[]
*/
public function classParameter( array $classIds ) {
$classParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsClassId' );
@@ -108,7 +108,7 @@
/**
* @param string $relation 'instance' or 'subclass'
- * @return array
+ * @return array[]
*/
public function relationParameter( $relation ) {
$relationParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsRelationId' );
@@ -133,8 +133,8 @@
}
/**
- * @param string $propertyId property ID serialization
- * @return array
+ * @param string $propertyId
+ * @return array[]
*/
public function propertyParameter( $propertyId ) {
$propertyParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsPropertyId' );
@@ -150,7 +150,7 @@
/**
* @param string[] $properties property ID serializations
- * @return array
+ * @return array[]
*/
public function propertiesParameter( array $properties ) {
$propertyParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsPropertyId' );
@@ -168,7 +168,7 @@
/**
* @param (string|Snak)[] $items item ID serializations or snaks
- * @return array
+ * @return array[]
*/
public function itemsParameter( array $items ) {
$qualifierParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsQualifierOfPropertyConstraintId' );
@@ -223,7 +223,7 @@
* @param string $type 'quantity' or 'time'
* @param DataValue|int|float|string|null $min lower boundary, see
rangeEndpoint() for details
* @param DataValue|int|float|string|null $max upper boundary, see
rangeEndpoint() for details
- * @return array
+ * @return array[]
*/
public function rangeParameter( $type, $min, $max ) {
$configKey = $type === 'quantity' ? 'Quantity' : 'Date';
@@ -241,7 +241,7 @@
/**
* @param string $namespace
- * @return array
+ * @return array[]
*/
public function namespaceParameter( $namespace ) {
$namespaceId = $this->getDefaultConfig()->get(
'WBQualityConstraintsNamespaceId' );
@@ -252,7 +252,7 @@
/**
* @param string $format
- * @return array
+ * @return array[]
*/
public function formatParameter( $format ) {
$formatId = $this->getDefaultConfig()->get(
'WBQualityConstraintsFormatAsARegularExpressionId' );
@@ -264,7 +264,7 @@
/**
* @param string $languageCode
* @param string $syntaxClarification
- * @return array
+ * @return array[]
*/
public function syntaxClarificationParameter( $languageCode,
$syntaxClarification ) {
$syntaxClarificationId = $this->getDefaultConfig()->get(
'WBQualityConstraintsSyntaxClarificationId' );
@@ -275,7 +275,7 @@
/**
* @param string[] $exceptions item ID serializations (other entity
types currently not supported)
- * @return array
+ * @return array[]
*/
public function exceptionsParameter( $exceptions ) {
$exceptionId = $this->getDefaultConfig()->get(
'WBQualityConstraintsExceptionToConstraintId' );
@@ -291,7 +291,7 @@
/**
* @param string $status (the only currently supported status is
'mandatory')
- * @return array
+ * @return array[]
*/
public function statusParameter( $status ) {
$statusParameterId = $this->getDefaultConfig()->get(
'WBQualityConstraintsConstraintStatusId' );
diff --git a/tests/phpunit/Fake/FakeSnakContext.php
b/tests/phpunit/Fake/FakeSnakContext.php
index c51f11e..2d6eaca 100644
--- a/tests/phpunit/Fake/FakeSnakContext.php
+++ b/tests/phpunit/Fake/FakeSnakContext.php
@@ -28,10 +28,17 @@
);
}
+ /**
+ * @return string
+ */
public function getType() {
return 'statement';
}
+ /**
+ * @param array|null $result
+ * @param array[] &$container
+ */
public function storeCheckResultInArray( $result, array &$container ) {
if ( $result !== null ) {
$container[] = $result;
--
To view, visit https://gerrit.wikimedia.org/r/400572
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I173b2c0e8fe5f56ff385b3389440a27130c60294
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits