Nuria has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370822 )

Change subject: Improve some parameter docs
......................................................................


Improve some parameter docs

Change-Id: Id838eceef041bab9f6fc10d542e05fd3c1a964a4
---
M composer.json
M includes/ApiJsonSchema.php
M includes/EventLogging.php
M includes/EventLoggingHooks.php
M includes/JsonSchema.php
M includes/RemoteSchema.php
M phpcs.xml
7 files changed, 47 insertions(+), 11 deletions(-)

Approvals:
  jenkins-bot: Verified
  Nuria: Checked; Looks good to me, approved



diff --git a/composer.json b/composer.json
index 55507be..91c6304 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
        },
        "scripts": {
                "test": [
-                       "parallel-lint . --exclude vendor",
+                       "parallel-lint . --exclude vendor --exclude 
node_modules",
                        "phpcs -p -s"
                ],
                "fix": [
diff --git a/includes/ApiJsonSchema.php b/includes/ApiJsonSchema.php
index a7caaa4..2bee672 100644
--- a/includes/ApiJsonSchema.php
+++ b/includes/ApiJsonSchema.php
@@ -45,6 +45,7 @@
 
        /**
         * @see ApiBase::getExamplesMessages()
+        * @return array
         */
        protected function getExamplesMessages() {
                return [
@@ -69,7 +70,7 @@
        /**
         * Emit an error response. Like ApiBase::dieUsageMsg, but sets
         * HTTP 400 ('Bad Request') status code.
-        * @param array|string: user error array
+        * @param array|string $error user error array
         */
        public function dieUsageMsg( $error ) {
                $parsed = $this->parseMsg( (array)$error );
diff --git a/includes/EventLogging.php b/includes/EventLogging.php
index 57d1ab4..0a16a31 100644
--- a/includes/EventLogging.php
+++ b/includes/EventLogging.php
@@ -19,6 +19,9 @@
         * This is meant to match the Navigator.sendBeacon() API.
         *
         * @see https://w3c.github.io/beacon/#sec-sendBeacon-method
+        * @param string $url
+        * @param array $data
+        * @return bool
         */
        public static function sendBeacon( $url, array $data = [] ) {
                DeferredUpdates::addCallableUpdate( function () use ( $url, 
$data ) {
diff --git a/includes/EventLoggingHooks.php b/includes/EventLoggingHooks.php
index 15a5c8d..c6a8265 100644
--- a/includes/EventLoggingHooks.php
+++ b/includes/EventLoggingHooks.php
@@ -103,7 +103,7 @@
 
        /**
         * @param array &$testModules
-        * @param ResourceLoader $resourceLoader
+        * @param ResourceLoader &$resourceLoader
         * @return bool
         */
        public static function onResourceLoaderTestModules( &$testModules, 
&$resourceLoader ) {
diff --git a/includes/JsonSchema.php b/includes/JsonSchema.php
index 8b6f7c6..bbd6a4f 100644
--- a/includes/JsonSchema.php
+++ b/includes/JsonSchema.php
@@ -69,6 +69,9 @@
        /**
         * Converts the string into something safe for an HTML id.
         * performs the easiest transformation to safe id, but is lossy
+        * @param int|string $var
+        * @return string
+        * @throws JsonSchemaException
         */
        public static function stringToId( $var ) {
                if ( is_int( $var ) ) {
@@ -83,6 +86,8 @@
        /**
         * Converts data to JSON format with pretty-formatting, but limited to 
a single line and escaped
         * to be suitable for wikitext message parameters.
+        * @param array $data
+        * @return string
         */
        public static function encodeForMsg( $data ) {
                if ( class_exists( 'FormatJson' ) && function_exists( 
'wfEscapeWikiText' ) ) {
@@ -98,6 +103,8 @@
        /**
         * Given a type (e.g. 'object', 'integer', 'string'), return the 
default/empty
         * value for that type.
+        * @param string $thistype
+        * @return mixed
         */
        public static function getNewValueForType( $thistype ) {
                switch ( $thistype ) {
@@ -127,6 +134,8 @@
 
        /**
         * Return a JSON-schema type for arbitrary data $foo
+        * @param mixed $foo
+        * @return mixed
         */
        public static function getType( $foo ) {
                if ( is_null( $foo ) ) {
@@ -161,6 +170,8 @@
 
        /**
         * Generate a schema from a data example ($parent)
+        * @param mixed $parent
+        * @return array
         */
        public static function getSchemaArray( $parent ) {
                $schema = [];
@@ -229,6 +240,7 @@
 
        /**
         * Associate the relevant node of the JSON schema to this node in the 
JSON
+        * @param null|string $schema
         */
        public function attachSchema( $schema = null ) {
                if ( !is_null( $schema ) ) {
@@ -244,6 +256,7 @@
        /**
         *  Return the title for this ref, typically defined in the schema as 
the
         *  user-friendly string for this node.
+        * @return string
         */
        public function getTitle() {
                if ( isset( $this->nodename ) ) {
@@ -258,6 +271,7 @@
        /**
         * Rename a user key.  Useful for interactive editing/modification, but 
not
         * so helpful for static interpretation.
+        * @param string $newindex
         */
        public function renamePropname( $newindex ) {
                $oldindex = $this->nodeindex;
@@ -271,6 +285,7 @@
        /**
         * Return the type of this node as specified in the schema.  If "any",
         * infer it from the data.
+        * @return mixed
         */
        public function getType() {
                if ( array_key_exists( 'type', $this->schemaref->node ) ) {
@@ -294,6 +309,7 @@
         * Return a unique identifier that may be used to find a node.  This
         * is only as robust as stringToId is (i.e. not that robust), but is
         * good enough for many cases.
+        * @return string
         */
        public function getFullIndex() {
                if ( is_null( $this->parent ) ) {
@@ -306,6 +322,7 @@
        /**
         *  Get a path to the element in the array.  if $foo['a'][1] would load 
the
         *  node, then the return value of this would be array('a',1)
+        * @return array
         */
        public function getDataPath() {
                if ( !is_object( $this->parent ) ) {
@@ -323,6 +340,7 @@
         *  the leaf node with a value of 4 would have a data path of 
'[1]["1a"]',
         *  while the leaf node with a value of 2 would have a data path of
         *  '[0]["0b"]["oba"]'
+        * @return string
         */
        public function getDataPathAsString() {
                $retval = "";
@@ -335,6 +353,7 @@
        /**
         *  Return data path in user-friendly terms.  This will use the same
         *  terminology as used in the user interface (1-indexed arrays)
+        * @return string
         */
        public function getDataPathTitles() {
                if ( !is_object( $this->parent ) ) {
@@ -347,6 +366,9 @@
 
        /**
         * Return the child ref for $this ref associated with a given $key
+        * @param string $key
+        * @return JsonTreeRef
+        * @throws JsonSchemaException
         */
        public function getMappingChildRef( $key ) {
                $snode = $this->schemaref->node;
@@ -377,6 +399,8 @@
 
        /**
         * Return the child ref for $this ref associated with a given index $i
+        * @param int $i
+        * @return JsonTreeRef
         */
        public function getSequenceChildRef( $i ) {
                // TODO: make this conform to draft-03 by also allowing single 
object
@@ -395,6 +419,7 @@
        /**
         * Validate the JSON node in this ref against the attached schema ref.
         * Return true on success, and throw a JsonSchemaException on failure.
+        * @return bool
         */
        public function validate() {
                if ( array_key_exists( 'enum', $this->schemaref->node ) &&
@@ -481,6 +506,8 @@
        public $idtable;
        /**
         * The whole tree is indexed on instantiation of this class.
+        * @param string $schema
+        * @return null|void
         */
        public function __construct( $schema ) {
                $this->root = $schema;
@@ -496,6 +523,7 @@
        /**
         * Recursively find all of the ids in this schema, and store them in the
         * index.
+        * @param string $schemanode
         */
        public function indexSubtree( $schemanode ) {
                if ( !array_key_exists( 'type', $schemanode ) ) {
@@ -524,6 +552,12 @@
        /**
         * Generate a new schema ref, or return an existing one from the index 
if
         * the node is an idref.
+        * @param string $node
+        * @param string $parent
+        * @param int $nodeindex
+        * @param string $nodename
+        * @return TreeRef
+        * @throws JsonSchemaException
         */
        public function newRef( $node, $parent, $nodeindex, $nodename ) {
                if ( array_key_exists( '$ref', $node ) ) {
diff --git a/includes/RemoteSchema.php b/includes/RemoteSchema.php
index fa3ce0e..b63e600 100644
--- a/includes/RemoteSchema.php
+++ b/includes/RemoteSchema.php
@@ -17,7 +17,7 @@
        /**
         * Constructor.
         * @param string $title
-        * @param integer $revision
+        * @param int $revision
         * @param ObjectCache $cache (optional) cache client.
         * @param Http $http (optional) HTTP client.
         */
@@ -55,6 +55,7 @@
 
        /**
         * Returns an object containing serializable properties.
+        * @return array
         */
        public function jsonSerialize() {
                return [
@@ -65,7 +66,7 @@
 
        /**
         * Retrieves content from memcached.
-        * @return array:bool Schema or false if not in cache.
+        * @return array|bool Schema or false if not in cache.
         */
        protected function memcGet() {
                return $this->cache->get( $this->key );
@@ -73,6 +74,7 @@
 
        /**
         * Store content in memcached.
+        * @return bool
         */
        protected function memcSet() {
                return $this->cache->set( $this->key, $this->content );
diff --git a/phpcs.xml b/phpcs.xml
index 92fcfc0..dbfcfe2 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -2,16 +2,12 @@
 <ruleset>
        <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
                <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
-               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamName" />
-               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
-               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingReturn" />
-               <exclude 
name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" />
                <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
                <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
                <exclude 
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
        </rule>
        <file>.</file>
        <arg name="extensions" value="php,php5,inc" />
-       <arg name="encoding" value="utf8" />
-       <exclude-pattern>vendor</exclude-pattern>
+       <arg name="encoding" value="UTF-8" />
+       <exclude-pattern type="relative">^server/*</exclude-pattern>
 </ruleset>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id838eceef041bab9f6fc10d542e05fd3c1a964a4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Nuria <nu...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to