jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/360679 )
Change subject: Enable some phpcs rules
......................................................................
Enable some phpcs rules
The following rules are now enabled and the code is fixed accordingly:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: I957412e6bfec60fa9064701cc3020c8e88fe7b17
---
M includes/GoogleLogin.body.php
M includes/GoogleLogin.hooks.php
M includes/GoogleUser.php
M includes/alloweddomains/AllowedDomainsStore.php
M includes/alloweddomains/EmailDomain.php
M includes/alloweddomains/MutableAllowedDomainsStore.php
M phpcs.xml
7 files changed, 45 insertions(+), 38 deletions(-)
Approvals:
Umherirrender: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/GoogleLogin.body.php b/includes/GoogleLogin.body.php
index 2e918cf..81edee3 100755
--- a/includes/GoogleLogin.body.php
+++ b/includes/GoogleLogin.body.php
@@ -6,19 +6,19 @@
use Google_Client;
use GoogleLogin\AllowedDomains\AllowedDomainsStore;
-use GoogleLogin\AllowedDomains\CachedAllowedDomainsStore;
use GoogleLogin\AllowedDomains\EmailDomain;
-use GoogleLogin\AllowedDomains\MutableAllowedDomainsStore;
use MediaWiki\MediaWikiServices;
class GoogleLogin {
- /** @var $mGoogleClient Stores an instance of GoogleClient */
+ /** @var Google_Client $mGoogleClient Stores an instance of
GoogleClient */
private static $mGoogleClient;
- /** @var $mConfig Config object created for GoogleLogin extension */
+ /** @var \Config $mConfig object created for GoogleLogin extension */
private static $mConfig;
/**
* Returns an prepared instance of Google client to do requests with to
Google API
+ * @param string $returnToUrl The URL to set for the redirectURI
+ * @param string $token The token to set for the Goolge_Client state
* @return Google_Client
*/
public static function getClient( $returnToUrl, $token ) {
diff --git a/includes/GoogleLogin.hooks.php b/includes/GoogleLogin.hooks.php
index 267107b..509645c 100644
--- a/includes/GoogleLogin.hooks.php
+++ b/includes/GoogleLogin.hooks.php
@@ -48,9 +48,11 @@
}
/**
- * Handles Updates to the UserMergeAccountFields of the UserMerge
extension.
+ * MergeAccountFromTo hook handler
*
- * @param array &$updateFields
+ * @param \User &$oldUser The user to "merge from"
+ * @param \User &$newUser The user to "merge to"
+ * @return bool
*/
public static function onMergeAccountFromTo( &$oldUser, &$newUser ) {
// check, if
@@ -79,7 +81,8 @@
* Handle, what data needs to be deleted from the GoogleLogin tables
when a user is
* deleted through the UserMerge extension.
*
- * @param array &$tablesToDelete
+ * @param array &$tablesToDelete Array of table => user_id_field to
delete
+ * @return bool
*/
public static function onUserMergeAccountDeleteTables( &$tablesToDelete
) {
$tablesToDelete['user_google_user'] = 'user_id';
@@ -91,10 +94,10 @@
* AuthChangeFormFields hook handler. Give the "Login with Google"
button a larger
* weight as the LocalPasswordAuthentication Log in button.
*
- * @param array $requests
- * @param array $fieldInfo
- * @param array $formDescriptor
- * @param $action
+ * @param array $requests AuthenticationRequests for the current auth
attempt
+ * @param array $fieldInfo Array of field information
+ * @param array &$formDescriptor Array of fields in a descriptor format
+ * @param string $action one of the AuthManager::ACTION_* constants.
*/
public static function onAuthChangeFormFields( array $requests, array
$fieldInfo,
array &$formDescriptor, $action
@@ -114,9 +117,9 @@
/**
* Add GoogleLogin management events to Echo
*
- * @param array $notifications Echo notifications
- * @param array $notificationCategories Echo categories
- * @param array $icons Echo icons
+ * @param array &$notifications Echo notifications
+ * @param array &$notificationCategories Echo categories
+ * @param array &$icons Echo icons
* @return bool
*/
public static function onBeforeCreateEchoEvent(
@@ -147,8 +150,8 @@
/**
* Bundle GoogleLogin echo notifications if they're made from the same
administrator.
*
- * @param \EchoEvent $event
- * @param String $bundleString
+ * @param \EchoEvent $event The triggering event
+ * @param String &$bundleString The message of the bundle
* @return boolean
*/
public static function onEchoGetBundleRules( \EchoEvent $event,
&$bundleString ) {
diff --git a/includes/GoogleUser.php b/includes/GoogleUser.php
index d829eed..1bc13b5 100644
--- a/includes/GoogleUser.php
+++ b/includes/GoogleUser.php
@@ -23,7 +23,7 @@
* will start a request to the Google+ API to find out the information
about
* the person who owns the given Google ID.
*
- * @param $googleId The Google ID for the new GoogleUser object
+ * @param int $googleId The Google ID for the new GoogleUser object
* @return GoogleUser
*/
public static function newFromGoogleId( $googleId ) {
@@ -80,7 +80,7 @@
* Returns the requested user data of the person with the Google ID
represented by this
* GoogleUser object or null, if the data is not available.
*
- * @param $data The data to retrieve
+ * @param string $data The data to retrieve
* @return null
*/
public function getData( $data ) {
@@ -115,8 +115,8 @@
/**
* Check, if the Google ID is already connected to another wiki account
or not.
*
- * @param $id
- * @param int $flags
+ * @param int $googleId The Google ID to check for
+ * @param int $flags A bit mask of flags, see User::READ_*
* @return bool
*/
public static function isGoogleIdFree( $googleId, $flags =
User::READ_LATEST ) {
@@ -129,7 +129,7 @@
*
* @param User $user The user to get the Google Id for
* @param integer $flags User::READ_* constant bitfield
- * @return bool False, if no Google ID connected with this User ID,
true otherwise
+ * @return null|array An array of user IDs, null if an error occurred
or no IDs was found
*/
public static function getGoogleIdFromUser( User $user, $flags =
User::READ_LATEST ) {
$db = ( $flags & User::READ_LATEST )
diff --git a/includes/alloweddomains/AllowedDomainsStore.php
b/includes/alloweddomains/AllowedDomainsStore.php
index d582d09..e385943 100644
--- a/includes/alloweddomains/AllowedDomainsStore.php
+++ b/includes/alloweddomains/AllowedDomainsStore.php
@@ -15,7 +15,8 @@
/**
* Checks, if the given EmailDomain is allowed to be used for login or
not.
*
- * @param EmailDomain $domain
+ * @param EmailDomain $domain The e-mail-address as an EmailDomain
object to check if it is
+ * contained in the store.
* @return boolean
*/
function contains( EmailDomain $domain );
diff --git a/includes/alloweddomains/EmailDomain.php
b/includes/alloweddomains/EmailDomain.php
index cd9c4fb..cf72db2 100644
--- a/includes/alloweddomains/EmailDomain.php
+++ b/includes/alloweddomains/EmailDomain.php
@@ -16,7 +16,7 @@
/**
* EmailDomain constructor.
*
- * @param $mail String The whole e-mail address, which is represented
by this object
+ * @param String $mail The whole e-mail address, which is represented
by this object
* @param bool $strict If the domain should be parsed strictly or not
(e.g.
* [email protected] will be converted to example.com if this is
false)
*/
@@ -66,10 +66,13 @@
// remove "/path/file.html", "/:80", etc.
$domain = parse_url( $domain, PHP_URL_HOST );
// separate domain level
- $lvl = explode( '.', $domain ); // 0 => www, 1 => example, 2 =>
co, 3 => uk
+ // 0 => www, 1 => example, 2 => co, 3 => uk
+ $lvl = explode( '.', $domain );
// set levels
- krsort( $lvl ); // 3 => uk, 2 => co, 1 => example, 0 => www
- $lvl = array_values( $lvl ); // 0 => uk, 1 => co, 2 => example,
3 => www
+ // 3 => uk, 2 => co, 1 => example, 0 => www
+ krsort( $lvl );
+ // 0 => uk, 1 => co, 2 => example, 3 => www
+ $lvl = array_values( $lvl );
$_1st = $lvl[0];
$_2nd = isset( $lvl[1] ) ? $lvl[1] . '.' . $_1st : false;
$_3rd = isset( $lvl[2] ) ? $lvl[2] . '.' . $_2nd : false;
@@ -81,7 +84,8 @@
}
require "$dir/cache/tld.txt";
$tlds = array_flip( $tlds );
- if ( // fourth level is TLD
+ // fourth level is TLD
+ if (
$_4th &&
!isset( $tlds[ '!' . $_4th ] ) &&
(
@@ -90,7 +94,8 @@
)
) {
$domain = isset( $lvl[4] ) ? $lvl[4] . '.' . $_4th :
false;
- } elseif ( // third level is TLD
+ // third level is TLD
+ } elseif (
$_3rd &&
!isset( $tlds[ '!' . $_3rd ] ) &&
(
@@ -99,7 +104,8 @@
)
) {
$domain = $_4th;
- } elseif ( // second level is TLD
+ // second level is TLD
+ } elseif (
!isset( $tlds[ '!' . $_2nd ] ) &&
(
isset( $tlds[ $_2nd ] ) ||
@@ -107,7 +113,8 @@
)
) {
$domain = $_3rd;
- } else { // first level is TLD
+ // first level is TLD
+ } else {
$domain = $_2nd;
}
return $domain;
diff --git a/includes/alloweddomains/MutableAllowedDomainsStore.php
b/includes/alloweddomains/MutableAllowedDomainsStore.php
index 1cb61ee..4d097f6 100644
--- a/includes/alloweddomains/MutableAllowedDomainsStore.php
+++ b/includes/alloweddomains/MutableAllowedDomainsStore.php
@@ -13,7 +13,8 @@
/**
* Adds the host of the given EmailDomain to the store.
*
- * @param EmailDomain $domain
+ * @param EmailDomain $domain The e-mail-address as an EmailDomain
object to add as allowed
+ * to the store
* @return integer The ID of the newly added entry (0 if IDs are not
used, -1 on failure)
*/
function add( EmailDomain $domain );
@@ -23,7 +24,8 @@
* Will return true, when the domain is not present anymore (either not
present before or
* successfully deleted), false otheriwse.
*
- * @param EmailDomain $domain
+ * @param EmailDomain $domain The e-mail-address as an EmailDomain
object to remove from the
+ * store.
* @return boolean
*/
function remove( EmailDomain $domain );
diff --git a/phpcs.xml b/phpcs.xml
index 92fcfc0..91aaf45 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,14 +1,8 @@
<?xml version="1.0"?>
<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" />
--
To view, visit https://gerrit.wikimedia.org/r/360679
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I957412e6bfec60fa9064701cc3020c8e88fe7b17
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits