Add phan configuration

Change-Id: I80852cc4ac4ea0bff3b07b2468216eb53271e250
This commit is contained in:
Kunal Mehta 2018-04-09 00:56:37 -07:00
parent 7451a5df33
commit 6e74fa9fba
6 changed files with 31 additions and 2 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
composer.lock
node_modules/
vendor/
tests/phan/issues

View file

@ -3,7 +3,8 @@
"jakub-onderka/php-parallel-lint": "1.0.0",
"mediawiki/mediawiki-codesniffer": "17.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/minus-x": "0.3.1"
"mediawiki/minus-x": "0.3.1",
"mediawiki/mediawiki-phan-config": "0.2.0"
},
"scripts": {
"lint": "parallel-lint . --exclude vendor --exclude node_modules",

View file

@ -58,6 +58,11 @@ class ApiQueryOATH extends ApiQueryBase {
$result->addValue( 'query', $this->getModuleName(), $data );
}
/**
* @param array $params
*
* @return string
*/
public function getCacheMode( $params ) {
return 'private';
}

View file

@ -16,6 +16,12 @@ use MediaWiki\Auth\AuthManager;
*/
class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticationProvider {
/**
* @param string $action
* @param array $options
*
* @return array
*/
public function getAuthenticationRequests( $action, array $options ) {
switch ( $action ) {
case AuthManager::ACTION_LOGIN:
@ -28,7 +34,11 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
/**
* If the user has enabled two-factor authentication, request a second factor.
* @inheritDoc
*
* @param User $user
* @param array $reqs
*
* @return AuthenticationResponse
*/
public function beginSecondaryAuthentication( $user, array $reqs ) {
$oathuser = OATHAuthHooks::getOATHUserRepository()->findByUser( $user );
@ -54,6 +64,7 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
}
$oathuser = OATHAuthHooks::getOATHUserRepository()->findByUser( $user );
/** @suppress PhanUndeclaredProperty */
$token = $request->OATHToken;
if ( $oathuser->getKey() === null ) {
@ -81,6 +92,13 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
}
}
/**
* @param User $user
* @param User $creator
* @param array $reqs
*
* @return AuthenticationResponse
*/
public function beginSecondaryAccountCreation( $user, $creator, array $reqs ) {
return AuthenticationResponse::newAbstain();
}

View file

@ -109,6 +109,7 @@ class HOTPResult {
protected $hash;
protected $binary;
protected $decimal;
protected $hex;
/**
* Build an HOTP Result

3
tests/phan/config.php Normal file
View file

@ -0,0 +1,3 @@
<?php
return require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';