format lint for PHPs

Signed-off-by: WaitSpring <me@waitspring.com>
这个提交包含在:
WaitSpring 2023-04-13 22:58:29 +08:00
父节点 5459b56dad
当前提交 d3f526c596
共有 3 个文件被更改,包括 232 次插入220 次删除

查看文件

@ -1,4 +1,5 @@
<?php
/**
* NewSignupPage extension for MediaWiki -- enhances the default signup form
*
@ -9,7 +10,8 @@
* @copyright Copyright © 2022- Qiuwen Baike Contributors
* @license GPL-2.0-or-later
*/
class NewSignupPage {
class NewSignupPage
{
/**
* Add the JavaScript file to the page output on the signup page.
@ -17,7 +19,8 @@ class NewSignupPage {
* @param OutputPage &$out
* @param Skin &$skin
*/
public static function onBeforePageDisplay( &$out, &$skin ) {
public static function onBeforePageDisplay(&$out, &$skin)
{
$title = $out->getTitle();
// Only do our magic if we're on the signup page or login page
@ -27,7 +30,6 @@ class NewSignupPage {
if ($title->isSpecial('CreateAccount') || $title->isSpecial('Userlogin')) {
$out->addModules(['ext.newsignuppage']);
}
}
/**
@ -38,7 +40,8 @@ class NewSignupPage {
* @param DatabaseUpdater $updater
* @return bool True when we should not do anything
*/
public static function onLoadExtensionSchemaUpdates( $updater ) {
public static function onLoadExtensionSchemaUpdates($updater)
{
global $wgRegisterTrack;
$db = $updater->getDB();
@ -57,5 +60,4 @@ class NewSignupPage {
$updater->addExtensionTable('user_register_track', $file);
}
}

查看文件

@ -7,7 +7,8 @@ use MediaWiki\Auth\AuthenticationRequest;
* @since MediaWiki 1.27
* @phan-file-suppress PhanTypeMismatchReturn It appears that phan seems to hate the retval of getFieldInfo()...
*/
class NewSignupPageAuthenticationRequest extends AuthenticationRequest {
class NewSignupPageAuthenticationRequest extends AuthenticationRequest
{
public $required = self::REQUIRED; // only ToS check is mandatory
/**
@ -38,12 +39,14 @@ class NewSignupPageAuthenticationRequest extends AuthenticationRequest {
/**
* @param WebRequest $request
*/
public function __construct( $request ) {
public function __construct($request)
{
$this->request = $request;
}
/** @inheritDoc */
public function getFieldInfo() {
public function getFieldInfo()
{
global $wgNewSignupPageToSURL, $wgNewSignupPagePPURL;
return [
'from' => [
@ -68,7 +71,8 @@ class NewSignupPageAuthenticationRequest extends AuthenticationRequest {
}
/** @inheritDoc */
public function loadFromSubmission( array $data ) {
public function loadFromSubmission(array $data)
{
// We always want to use this request, so ignore parent's return value.
parent::loadFromSubmission($data);

查看文件

@ -10,12 +10,14 @@ use MediaWiki\MediaWikiServices;
* @license GPL-2.0-or-later
* @note Uses GPL-licensed code from LoginReg extension (in beginSecondaryAccountCreation())
*/
class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticationProvider {
class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticationProvider
{
/**
* @param array $params
*/
public function __construct( $params = [] ) {
public function __construct($params = [])
{
}
/**
@ -28,7 +30,8 @@ class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuth
* @param array $reqs
* @return StatusValue
*/
public function testForAccountCreation( $user, $creator, array $reqs ) {
public function testForAccountCreation($user, $creator, array $reqs)
{
$req = AuthenticationRequest::getRequestByClass($reqs, NewSignupPageAuthenticationRequest::class);
if (
$req && $req->wpTermsOfService ||
@ -40,7 +43,8 @@ class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuth
}
}
public function getAuthenticationRequests( $action, array $options ) {
public function getAuthenticationRequests($action, array $options)
{
if ($action === AuthManager::ACTION_CREATE || $action === AuthManager::ACTION_LOGIN) {
return [new NewSignupPageAuthenticationRequest(
$this->manager->getRequest()
@ -50,15 +54,18 @@ class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuth
return [];
}
public function beginSecondaryAuthentication( $user, array $reqs ) {
public function beginSecondaryAuthentication($user, array $reqs)
{
return AuthenticationResponse::newAbstain();
}
public function beginSecondaryAccountCreation( $user, $creator, array $reqs ) {
public function beginSecondaryAccountCreation($user, $creator, array $reqs)
{
global $wgAutoAddFriendOnInvite, $wgRegisterTrack;
$req = AuthenticationRequest::getRequestByClass(
$reqs, NewSignupPageAuthenticationRequest::class
$reqs,
NewSignupPageAuthenticationRequest::class
);
$referral_user = User::newFromName($req->referral);
@ -148,5 +155,4 @@ class NewSignupPageSecondaryAuthenticationProvider extends AbstractSecondaryAuth
return AuthenticationResponse::newPass();
}
}