jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/359444 )
Change subject: Improve constraint parameter documentation
......................................................................
Improve constraint parameter documentation
The documentation for constraint parameters is moved from
ConstraintStatementParameterParser to
Constraint::getConstraintParameters() and expanded to explain the
structure of the array more precisely. All $constraintParameters
parameters of the parser’s public methods get a link to the new
documentation.
Change-Id: Ibeff929eac808f29eb74df00f3923cfadf546b63
---
M includes/Constraint.php
M includes/ConstraintCheck/Helper/ConstraintStatementParameterParser.php
2 files changed, 17 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/includes/Constraint.php b/includes/Constraint.php
index c0c1334..767cedd 100644
--- a/includes/Constraint.php
+++ b/includes/Constraint.php
@@ -89,7 +89,16 @@
}
/**
- * @return array (key: string with parameter name (e.g. 'property');
value: string (e.g. 'P21'))
+ * There are two formats of constraint parameters that this method can
return:
+ *
+ * 1. Statement parameters were imported from constraint statements by
{@link UpdateConstraintsTableJob}.
+ * They are lists of snak array serializations, indexed by property
ID serialization.
+ * 2. Template parameters were imported from constraint templates on
property talk pages.
+ * They are plain strings (e. g. 'Q5,Q6,Q7') indexed by template
parameters (e. g. 'item', 'property').
+ *
+ * Support for template parameters will soon be removed.
+ *
+ * @return array
*/
public function getConstraintParameters() {
return $this->constraintParameters;
diff --git
a/includes/ConstraintCheck/Helper/ConstraintStatementParameterParser.php
b/includes/ConstraintCheck/Helper/ConstraintStatementParameterParser.php
index 8b605d6..4cb352a 100644
--- a/includes/ConstraintCheck/Helper/ConstraintStatementParameterParser.php
+++ b/includes/ConstraintCheck/Helper/ConstraintStatementParameterParser.php
@@ -22,14 +22,11 @@
* Helper for parsing constraint parameters
* that were imported from constraint statements.
*
- * All public methods of this class expect snak array serializations,
- * as stored by {@link
\WikibaseQuality\ConstraintReport\UpdateConstraintsTableJob},
+ * All public methods of this class expect constraint parameters
+ * (see {@link \WikibaseQuality\Constraint::getConstraintParameters()})
* and return parameter objects or throw {@link ConstraintParameterException}s.
* The results are used by the checkers,
* which may include rendering them into violation messages.
- * (For backwards compatibility, the methods currently also support
- * parsing constraint parameters from templates.
- * This will be removed eventually.)
*
* Not to be confused with {@link ConstraintParameterParser},
* which parses constraint parameters from templates.
@@ -145,7 +142,7 @@
}
/**
- * @param array $constraintParameters
+ * @param array $constraintParameters see {@link
\WikibaseQuality\Constraint::getConstraintParameters()}
* @param string $constraintTypeName used in error messages
* @throws ConstraintParameterException if the parameter is invalid or
missing
* @return string[] class entity ID serializations
@@ -201,7 +198,7 @@
}
/**
- * @param array $constraintParameters
+ * @param array $constraintParameters see {@link
\WikibaseQuality\Constraint::getConstraintParameters()}
* @param string $constraintTypeName used in error messages
* @throws ConstraintParameterException if the parameter is invalid or
missing
* @return string 'instance' or 'subclass'
@@ -272,7 +269,7 @@
}
/**
- * @param array $constraintParameters
+ * @param array $constraintParameters see {@link
\WikibaseQuality\Constraint::getConstraintParameters()}
* @param string $constraintTypeName used in error messages
* @throws ConstraintParameterException if the parameter is invalid or
missing
* @return PropertyId
@@ -356,7 +353,7 @@
}
/**
- * @param array $constraintParameters
+ * @param array $constraintParameters see {@link
\WikibaseQuality\Constraint::getConstraintParameters()}
* @param string $constraintTypeName used in error messages
* @param bool $required whether the parameter is required (error if
absent) or not ([] if absent)
* @throws ConstraintParameterException if the parameter is invalid or
missing
@@ -420,7 +417,7 @@
}
/**
- * @param array $constraintParameters
+ * @param array $constraintParameters see {@link
\WikibaseQuality\Constraint::getConstraintParameters()}
* @param string $constraintTypeName used in error messages
* @throws ConstraintParameterException if the parameter is invalid or
missing
* @return PropertyId[]
--
To view, visit https://gerrit.wikimedia.org/r/359444
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibeff929eac808f29eb74df00f3923cfadf546b63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: 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