Umherirrender has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403740 )
Change subject: Improve some parameter docs
......................................................................
Improve some parameter docs
Change-Id: Ie97524f0e613a8438633ed78e74560b415a015d2
---
M .phpcs.xml
M Memento/Memento.body.php
M Memento/MementoResource.php
M Memento/TimeMap.php
M Memento/TimeMapResource.php
M tests/lib/HTTPFetch.php
M tests/lib/MementoParse.php
M tests/lib/TestSupport.php
8 files changed, 47 insertions(+), 47 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Memento
refs/changes/40/403740/1
diff --git a/.phpcs.xml b/.phpcs.xml
index 545cabc..2dc2bbf 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -2,8 +2,6 @@
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.Files.LineLength.TooLong" />
- <exclude
name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
- <exclude
name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" />
<exclude
name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
<exclude name="Generic.PHP.BacktickOperator.Found" />
<exclude
name="MediaWiki.NamingConventions.ValidGlobalName.wgPrefix" />
@@ -12,10 +10,8 @@
<exclude
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
- <exclude
name="MediaWiki.Commenting.FunctionComment.SpacingAfter" />
<exclude
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude
name="MediaWiki.NamingConventions.PrefixedGlobalFunctions.wfPrefix" />
- <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle"
/>
</rule>
<file>.</file>
<arg name="bootstrap"
value="./vendor/mediawiki/mediawiki-codesniffer/utils/bootstrap-ci.php"/>
diff --git a/Memento/Memento.body.php b/Memento/Memento.body.php
index 516904c..7b3ec7e 100644
--- a/Memento/Memento.body.php
+++ b/Memento/Memento.body.php
@@ -34,17 +34,17 @@
class Memento {
/**
- * @var MementoResource $mementoResource: object that implements memento
+ * @var MementoResource $mementoResource object that implements memento
*/
private $mementoResource;
/**
- * @var string $articleDatetime: datetime of the article loaded
+ * @var string $articleDatetime datetime of the article loaded
*/
private $articleDatetime;
/**
- * @var boolean $oldIDSet: flag to indicate if this is an oldid page
+ * @var bool $oldIDSet flag to indicate if this is an oldid page
*/
private $oldIDSet;
@@ -52,13 +52,13 @@
* The ImageBeforeProduce HTML hook, used here to provide datetime
* negotiation for embedded images.
*
- * @param Skin $skin Skin object for this page
- * @param Title $title Title object for this image
- * @param File $file File object for this image
- * @param array $frameParams frame parameters
- * @param array $handlerParams handler parameters
- * @param string $time not really used by hook
- * @param string $res used to replace HTML for image rendering
+ * @param Skin &$skin Skin object for this page
+ * @param Title &$title Title object for this image
+ * @param File &$file File object for this image
+ * @param array &$frameParams frame parameters
+ * @param array &$handlerParams handler parameters
+ * @param string &$time not really used by hook
+ * @param string &$res used to replace HTML for image rendering
*
* @return bool indicating whether caller should use $res instead of
* default HTML for image rendering
@@ -90,8 +90,8 @@
*
* @param Parser $parser Parser object for this page
* @param Title $title Title object for this page
- * @param bool $skip boolean flag allowing the caller to skip the rest
of statelessFetchTemplate
- * @param int $id revision id of this page
+ * @param bool &$skip boolean flag allowing the caller to skip the rest
of statelessFetchTemplate
+ * @param int &$id revision id of this page
*
* @return bool indicating success to the caller
*/
@@ -112,10 +112,10 @@
*
* Note: this is not called when the Edit, Diff or History pages are
loaded.
*
- * @param Article $article pointer to the Article Object from the hook
- * @param bool $outputDone pointer to variable that indicates that
+ * @param Article &$article pointer to the Article Object from the hook
+ * @param bool &$outputDone pointer to variable that indicates that
* the output should be terminated
- * @param bool $pcache pointer to variable that indicates whether the
parser
+ * @param bool &$pcache pointer to variable that indicates whether the
parser
* cache should try retrieving the cached results
*
* @return bool indicating success to the caller
diff --git a/Memento/MementoResource.php b/Memento/MementoResource.php
index cfdd146..426491b 100644
--- a/Memento/MementoResource.php
+++ b/Memento/MementoResource.php
@@ -463,7 +463,7 @@
* @fixme make this compatible with parser cache
* @param Title $title
* @param Parser $parser
- * @param int $id
+ * @param int &$id
*
* @return array containing the text, finalTitle, and deps
*/
diff --git a/Memento/TimeMap.php b/Memento/TimeMap.php
index 8b4e9cb..5d537d7 100644
--- a/Memento/TimeMap.php
+++ b/Memento/TimeMap.php
@@ -53,7 +53,7 @@
* The init function that is called by mediawiki when loading this
* SpecialPage.
*
- * @param string $urlpar the title parameter returned by Mediawiki
+ * @param string $urlparam the title parameter returned by Mediawiki
* which, in this case, is the URI for
which we want TimeMaps
*/
public function execute( $urlparam ) {
diff --git a/Memento/TimeMapResource.php b/Memento/TimeMapResource.php
index 2fafc74..42d0988 100644
--- a/Memento/TimeMapResource.php
+++ b/Memento/TimeMapResource.php
@@ -135,7 +135,6 @@
*
* @return Title title object created from URL parsing
*/
-
public static function deriveTitleObject( $urlparam ) {
if ( self::isPivotAscending( $urlparam ) ) {
$title = preg_replace(
@@ -262,14 +261,13 @@
*
* @param int $pgID the ID of the page, not the oldid
* @param string $pivotTimestamp the pivotTimestamp in TS_MW format
- * @param array $timeMapPages array passed by reference to hold TimeMap
pages
+ * @param array &$timeMapPages array passed by reference to hold
TimeMap pages
* @param Title $title the title of the page
*
* @return array $timeMapPages - same array that was passed by reference
* and altered, but now contains an entry that is
an array with
* keys of uri, from, and until representing the
next Time Map,
* its starting time and ending time
- *
*/
public function generateAscendingTimeMapPaginationData(
$pgID, $pivotTimestamp, &$timeMapPages, $title ) {
@@ -298,7 +296,7 @@
*
* @param int $pgID the ID of the page, not the oldid
* @param string $pivotTimestamp the pivotTimestamp in TS_MW format
- * @param array $timeMapPages array passed by reference to hold TimeMap
pages
+ * @param array &$timeMapPages array passed by reference to hold
TimeMap pages
* @param Title $title the title of the page
*
* @return array $timeMapPages same array that was passed by reference
diff --git a/tests/lib/HTTPFetch.php b/tests/lib/HTTPFetch.php
index e43dfdb..4fe3a89 100644
--- a/tests/lib/HTTPFetch.php
+++ b/tests/lib/HTTPFetch.php
@@ -2,10 +2,11 @@
require_once getenv( 'TESTDATADIR' ) . '/authentication-data.php';
-/*
+/**
* Given an HTTP $response, extracts the headers into a more easy-to-use
* key,value pair stored in an array.
- *
+ * @param string $response
+ * @return array
*/
function extractHeadersFromResponse( $response ) {
$lines = preg_split( "/\r\n/", $response );
@@ -30,9 +31,11 @@
return $headers;
}
-/*
+/**
* Given an HTTP $response, extracts the status line into a more easy-to-use
* key, value pair stored in an array.
+ * @param string $response
+ * @return array
*/
function extractStatuslineFromResponse( $response ) {
$lines = preg_split( "/\r\n/", $response );
@@ -57,9 +60,10 @@
return $statusline;
}
-/*
+/**
* Given an HTTP $response, extracts the entity from the response as $entity.
- *
+ * @param string $response
+ * @return string
*/
function extractEntityFromResponse( $response ) {
$entity = null;
@@ -68,9 +72,10 @@
return $entity;
}
-/*
+/**
* Get the cookies set in the response
- *
+ * @param string $response
+ * @return array
*/
function extractCookiesSetInResponse( $response ) {
$lines = preg_split( "/\r\n/", $response );
@@ -96,8 +101,9 @@
return $cookies;
}
-/*
+/**
* Authenticate!!!
+ * @return string
*/
function authenticateWithMediawiki() {
global $mwLoginFormUrl;
@@ -153,10 +159,9 @@
return $sessionCookieString;
}
-/*
+/**
* Log out!!!
*/
-
function logOutOfMediawiki() {
global $sessionCookieString;
global $mwLogoutActionUrl;
@@ -166,8 +171,10 @@
$response = `curl -s -e '$uagent' -b '$sessionCookieString' -k
-i --url '$mwLogoutActionUrl'`;
}
-/*
+/**
* only get the headers as a string, no processing
+ * @param string $response
+ * @return array
*/
function extractHeadersStringFromResponse( $response ) {
$lines = preg_split( "/\r\n/", $response );
diff --git a/tests/lib/MementoParse.php b/tests/lib/MementoParse.php
index d6b2fea..e2f672d 100644
--- a/tests/lib/MementoParse.php
+++ b/tests/lib/MementoParse.php
@@ -1,19 +1,20 @@
<?php
-/*
+/**
* Given the string $linkvalues, which is the value part of the Link: header,
* return an array of key-value pairs for easier access, but only the ones
* that correspond to the Memento standard.
*
- * Note: str_getcsv doesn't work because the Link header isn't actually in
- * the CSV format:
- * <url>;rel="something";datetime="somethingwith
,",<url>...
- * because datetime="something with ,"
- * instead of "datetime=something with ,"
+ * Note: str_getcsv doesn't work because the Link header isn't actually in
+ * the CSV format:
+ * <url>;rel="something";datetime="somethingwith ,",<url>...
+ * because datetime="something with ,"
+ * instead of "datetime=something with ,"
*
* This function had to use regex instead, which limits it to just the memento
* items.
- *
+ * @param string $linkvalues
+ * @return array
*/
function extractItemsFromLink( $linkvalues ) {
$relations = [];
diff --git a/tests/lib/TestSupport.php b/tests/lib/TestSupport.php
index a667804..c646552 100644
--- a/tests/lib/TestSupport.php
+++ b/tests/lib/TestSupport.php
@@ -44,11 +44,9 @@
return $data;
}
-/*
- shamelessly stolen from:
-
http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
- */
function objectToArray( $d ) {
+ // shamelessly stolen from:
+ //
http://www.if-not-true-then-false.com/2009/php-tip-convert-stdclass-object-to-multidimensional-array-and-convert-multidimensional-array-to-stdclass-object/
if ( is_object( $d ) ) {
// Gets the properties of the given object
// with get_object_vars function
--
To view, visit https://gerrit.wikimedia.org/r/403740
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie97524f0e613a8438633ed78e74560b415a015d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Memento
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits