Merge "Remove and fix remaining phpcs exclusions"

This commit is contained in:
jenkins-bot 2019-11-10 18:33:12 +00:00 committed by Gerrit Code Review
commit 942ee5817f
10 changed files with 49 additions and 5 deletions

View file

@ -1,9 +1,6 @@
<?xml version="1.0"?>
<ruleset name="MediaWiki">
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
</rule>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="encoding" value="UTF-8" />
<arg name="extensions" value="php,php5,inc,sample" />

View file

@ -92,6 +92,11 @@ class ApiOATHValidate extends ApiBase {
$this->getResult()->addValue( null, $this->getModuleName(), $result );
}
/**
* @param array $params
*
* @return string
*/
public function getCacheMode( $params ) {
return 'private';
}
@ -104,6 +109,9 @@ class ApiOATHValidate extends ApiBase {
return 'csrf';
}
/**
* @return array
*/
public function getAllowedParams() {
return [
'user' => [
@ -119,6 +127,9 @@ class ApiOATHValidate extends ApiBase {
];
}
/**
* @return array
*/
protected function getExamplesMessages() {
return [
'action=oathvalidate&totp=123456&token=123ABC'

View file

@ -19,6 +19,7 @@
namespace MediaWiki\Extension\OATHAuth\Api\Module;
use MediaWiki\MediaWikiServices;
use ApiQuery;
use ApiQueryBase;
use ApiBase;
use ApiResult;
@ -35,6 +36,10 @@ use User;
* @ingroup Extensions
*/
class ApiQueryOATH extends ApiQueryBase {
/**
* @param ApiQuery $query
* @param string $moduleName
*/
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'oath' );
}
@ -81,6 +86,9 @@ class ApiQueryOATH extends ApiQueryBase {
return true;
}
/**
* @return array
*/
public function getAllowedParams() {
return [
'user' => [
@ -89,6 +97,9 @@ class ApiQueryOATH extends ApiQueryBase {
];
}
/**
* @return array
*/
protected function getExamplesMessages() {
return [
'action=query&meta=oath'

View file

@ -36,6 +36,9 @@ class TOTPAuthenticationRequest extends AuthenticationRequest {
] + parent::describeCredentials();
}
/**
* @return array
*/
public function getFieldInfo() {
return [
'OATHToken' => [

View file

@ -101,6 +101,9 @@ abstract class OATHAuthOOUIHTMLForm extends OOUIHTMLForm implements IManageForm
return LoggerFactory::getInstance( 'authentication' );
}
/**
* @inheritDoc
*/
protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
// to get a user visible effect, wrap the fieldset into a framed panel layout
$layout = new PanelLayout( array_merge( [

View file

@ -15,6 +15,9 @@ class TOTPDisableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
$this->getOutput()->addWikiMsg( 'oathauth-disabledoath' );
}
/**
* @return array
*/
protected function getDescriptors() {
return [
'token' => [

View file

@ -26,6 +26,9 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
$this->getOutput()->addWikiMsg( 'oathauth-validatedoath' );
}
/**
* @return array
*/
protected function getDescriptors() {
$keyData = $this->getRequest()->getSessionData( 'oathauth_totp_key' ) ?? [];
$key = TOTPKey::newFromArray( $keyData );

View file

@ -8,6 +8,7 @@ use OOUI\HorizontalLayout;
use OOUI\LabelWidget;
use OOUI\ButtonWidget;
use SpecialPage;
use User;
class AuthModule {
/**
@ -24,7 +25,7 @@ class AuthModule {
protected $preferences;
/**
* @param \User $user
* @param User $user
* @param array &$preferences
* @return bool
*/
@ -34,6 +35,11 @@ class AuthModule {
return $handler->execute();
}
/**
* @param OATHUserRepository $userRepo
* @param User $user
* @param array &$preferences
*/
protected function __construct( $userRepo, $user, &$preferences ) {
$this->userRepo = $userRepo;
$this->user = $user;

View file

@ -14,6 +14,7 @@ use MediaWiki\Extension\OATHAuth\Special\OATHManage;
use MWException;
use MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm;
use MediaWiki\Extension\OATHAuth\Auth\TOTPSecondaryAuthenticationProvider;
use Message;
class TOTP implements IModule {
public static function factory() {
@ -28,6 +29,9 @@ class TOTP implements IModule {
return "totp";
}
/**
* @return Message
*/
public function getDisplayName() {
return wfMessage( 'oathauth-module-totp-label' );
}

View file

@ -30,6 +30,9 @@ class DisableOATHForUser extends FormSpecialPage {
return true;
}
/**
* @return string
*/
protected function getLoginSecurityLevel() {
return $this->getName();
}