build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
Exclude failing sniff to fix in follow ups Includes some simply fix, most are autofix Change-Id: I5bb4743f08618bb6226bc2a4cc7f4d73a7ad142d
This commit is contained in:
parent
c507bff9f6
commit
d621adbcb6
13 changed files with 79 additions and 59 deletions
23
.phpcs.xml
23
.phpcs.xml
|
|
@ -5,6 +5,17 @@
|
|||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingVar" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.NotShortBoolVar" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.NotShortIntVar" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.SpacingAfter" />
|
||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.WrongStyle" />
|
||||
<exclude name="MediaWiki.Commenting.RedundantVarName.Found" /><!-- autofix -->
|
||||
<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
|
||||
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
|
||||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||
|
|
@ -12,8 +23,20 @@
|
|||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgUser" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgVersion" />
|
||||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
|
||||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.is_resource" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
|
||||
<exclude name="MediaWiki.Usage.PHPUnitAssertEquals.False" /><!-- autofix -->
|
||||
<exclude name="MediaWiki.Usage.PHPUnitAssertEquals.True" /><!-- autofix -->
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgCommandLineMode" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgFullyInitialised" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgHooks" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgOut" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgPoolCounterConf" />
|
||||
<exclude name="MediaWiki.VariableAnalysis.MisleadingGlobalNames.Misleading$wgSessionCacheType" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
|
||||
</rule>
|
||||
<!-- TODO Still to be done -->
|
||||
<rule ref="MediaWiki.Commenting.FunctionComment.WrongStyle">
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
"hamcrest/hamcrest-php": "^2.0",
|
||||
"johnkary/phpunit-speedtrap": "^3.1",
|
||||
"justinrainbow/json-schema": "~5.2",
|
||||
"mediawiki/mediawiki-codesniffer": "31.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "32.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.10.3",
|
||||
"monolog/monolog": "~1.25.3",
|
||||
"nikic/php-parser": "4.10.0",
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class OrderedStreamingForkController extends ForkController {
|
|||
$this->updateAvailableSockets( $sockets, $used, $sockets ? 0 : 5 );
|
||||
} while ( !$sockets );
|
||||
}
|
||||
if ( substr( $data, - 1 ) === "\n" ) {
|
||||
if ( substr( $data, -1 ) === "\n" ) {
|
||||
// Strip any final new line used to delimit lines of input.
|
||||
// The last line of input might not have it, though.
|
||||
$data = substr( $data, 0, -1 );
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ class EntryPoint {
|
|||
private static function createRouter(
|
||||
IContextSource $context, RequestInterface $request, ResponseFactory $responseFactory, CorsUtils $cors
|
||||
): Router {
|
||||
global $IP;
|
||||
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$conf = $services->getMainConfig();
|
||||
|
||||
|
|
|
|||
|
|
@ -480,12 +480,12 @@ class AuthManager implements LoggerAwareInterface {
|
|||
foreach ( $this->getPrimaryAuthenticationProviders() as $id => $provider ) {
|
||||
$res = $provider->beginPrimaryAuthentication( $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$state['primary'] = $id;
|
||||
$state['primaryResponse'] = $res;
|
||||
$this->logger->debug( "Primary login with $id succeeded" );
|
||||
break 2;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( "Login failed in primary authentication by $id" );
|
||||
if ( $res->createRequest || $state['maybeLink'] ) {
|
||||
$res->createRequest = new CreateFromLoginAuthenticationRequest(
|
||||
|
|
@ -499,11 +499,11 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$this->getHookRunner()->onAuthManagerLoginAuthenticateAudit(
|
||||
$res, null, $guessUserName, [] );
|
||||
return $res;
|
||||
case AuthenticationResponse::ABSTAIN;
|
||||
case AuthenticationResponse::ABSTAIN:
|
||||
// Continue loop
|
||||
break;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( "Primary login with $id returned $res->status" );
|
||||
$this->fillRequests( $res->neededRequests, self::ACTION_LOGIN, $guessUserName );
|
||||
$state['primary'] = $id;
|
||||
|
|
@ -548,11 +548,11 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$id = $provider->getUniqueId();
|
||||
$res = $provider->continuePrimaryAuthentication( $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$state['primaryResponse'] = $res;
|
||||
$this->logger->debug( "Primary login with $id succeeded" );
|
||||
break;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( "Login failed in primary authentication by $id" );
|
||||
if ( $res->createRequest || $state['maybeLink'] ) {
|
||||
$res->createRequest = new CreateFromLoginAuthenticationRequest(
|
||||
|
|
@ -566,8 +566,8 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$this->getHookRunner()->onAuthManagerLoginAuthenticateAudit(
|
||||
$res, null, $guessUserName, [] );
|
||||
return $res;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( "Primary login with $id returned $res->status" );
|
||||
$this->fillRequests( $res->neededRequests, self::ACTION_LOGIN, $guessUserName );
|
||||
$state['continueRequests'] = $res->neededRequests;
|
||||
|
|
@ -679,21 +679,21 @@ class AuthManager implements LoggerAwareInterface {
|
|||
continue;
|
||||
}
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->debug( "Secondary login with $id succeeded" );
|
||||
// fall through
|
||||
case AuthenticationResponse::ABSTAIN;
|
||||
case AuthenticationResponse::ABSTAIN:
|
||||
$state['secondary'][$id] = true;
|
||||
break;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( "Login failed in secondary authentication by $id" );
|
||||
$this->callMethodOnProviders( 7, 'postAuthentication', [ $user, $res ] );
|
||||
$session->remove( 'AuthManager::authnState' );
|
||||
$this->getHookRunner()->onAuthManagerLoginAuthenticateAudit(
|
||||
$res, $user, $user->getName(), [] );
|
||||
return $res;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( "Secondary login with $id returned " . $res->status );
|
||||
$this->fillRequests( $res->neededRequests, self::ACTION_LOGIN, $user->getName() );
|
||||
$state['secondary'][$id] = false;
|
||||
|
|
@ -1340,7 +1340,7 @@ class AuthManager implements LoggerAwareInterface {
|
|||
}
|
||||
$res = $provider->beginPrimaryAccountCreation( $user, $creator, $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation passed by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1348,7 +1348,7 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$state['primary'] = $id;
|
||||
$state['primaryResponse'] = $res;
|
||||
break 2;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation failed by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1356,11 +1356,11 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$this->callMethodOnProviders( 7, 'postAccountCreation', [ $user, $creator, $res ] );
|
||||
$session->remove( 'AuthManager::accountCreationState' );
|
||||
return $res;
|
||||
case AuthenticationResponse::ABSTAIN;
|
||||
case AuthenticationResponse::ABSTAIN:
|
||||
// Continue loop
|
||||
break;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation $res->status by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1407,14 +1407,14 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$id = $provider->getUniqueId();
|
||||
$res = $provider->continuePrimaryAccountCreation( $user, $creator, $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation passed by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
] );
|
||||
$state['primaryResponse'] = $res;
|
||||
break;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation failed by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1422,8 +1422,8 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$this->callMethodOnProviders( 7, 'postAccountCreation', [ $user, $creator, $res ] );
|
||||
$session->remove( 'AuthManager::accountCreationState' );
|
||||
return $res;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( __METHOD__ . ": Primary creation $res->status by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1510,17 +1510,17 @@ class AuthManager implements LoggerAwareInterface {
|
|||
continue;
|
||||
}
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->debug( __METHOD__ . ": Secondary creation passed by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
] );
|
||||
// fall through
|
||||
case AuthenticationResponse::ABSTAIN;
|
||||
case AuthenticationResponse::ABSTAIN:
|
||||
$state['secondary'][$id] = true;
|
||||
break;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( __METHOD__ . ": Secondary creation $res->status by $id", [
|
||||
'user' => $user->getName(),
|
||||
'creator' => $creator->getName(),
|
||||
|
|
@ -1530,7 +1530,7 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$state['continueRequests'] = $res->neededRequests;
|
||||
$session->setSecret( 'AuthManager::accountCreationState', $state );
|
||||
return $res;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
throw new \DomainException(
|
||||
get_class( $provider ) . "::{$func}() returned $res->status." .
|
||||
' Secondary providers are not allowed to fail account creation, that' .
|
||||
|
|
@ -1893,26 +1893,26 @@ class AuthManager implements LoggerAwareInterface {
|
|||
|
||||
$res = $provider->beginPrimaryAccountLink( $user, $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->info( "Account linked to {user} by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] );
|
||||
return $res;
|
||||
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] );
|
||||
return $res;
|
||||
|
||||
case AuthenticationResponse::ABSTAIN;
|
||||
case AuthenticationResponse::ABSTAIN:
|
||||
// Continue loop
|
||||
break;
|
||||
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
|
|
@ -2000,22 +2000,22 @@ class AuthManager implements LoggerAwareInterface {
|
|||
$id = $provider->getUniqueId();
|
||||
$res = $provider->continuePrimaryAccountLink( $user, $reqs );
|
||||
switch ( $res->status ) {
|
||||
case AuthenticationResponse::PASS;
|
||||
case AuthenticationResponse::PASS:
|
||||
$this->logger->info( "Account linked to {user} by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] );
|
||||
$session->remove( 'AuthManager::accountLinkState' );
|
||||
return $res;
|
||||
case AuthenticationResponse::FAIL;
|
||||
case AuthenticationResponse::FAIL:
|
||||
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] );
|
||||
$session->remove( 'AuthManager::accountLinkState' );
|
||||
return $res;
|
||||
case AuthenticationResponse::REDIRECT;
|
||||
case AuthenticationResponse::UI;
|
||||
case AuthenticationResponse::REDIRECT:
|
||||
case AuthenticationResponse::UI:
|
||||
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [
|
||||
'user' => $user->getName(),
|
||||
] );
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class Diff {
|
|||
* $diff = new Diff($lines1, $lines2);
|
||||
* $rev = $diff->reverse();
|
||||
*
|
||||
* @return Object A Diff object representing the inverse of the
|
||||
* @return object A Diff object representing the inverse of the
|
||||
* original diff.
|
||||
*/
|
||||
public function reverse() {
|
||||
|
|
|
|||
|
|
@ -954,7 +954,6 @@ class FormatMetadata extends ContextSource {
|
|||
case 'Event':
|
||||
case 'OrginisationInImage':
|
||||
case 'PersonInImage':
|
||||
|
||||
$val = htmlspecialchars( $val );
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class PoolWorkArticleView extends PoolCounterWork {
|
|||
// Reduce effects of race conditions for slow parses (T48014)
|
||||
$cacheTime = wfTimestampNow();
|
||||
|
||||
$time = - microtime( true );
|
||||
$time = -microtime( true );
|
||||
$this->parserOutput = $renderedRevision->getRevisionParserOutput();
|
||||
$time += microtime( true );
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class TimezoneFilter implements Filter {
|
|||
$data[1] = intval( $data[1] );
|
||||
$minDiff = abs( $data[0] ) * 60 + $data[1];
|
||||
if ( $data[0] < 0 ) {
|
||||
$minDiff = - $minDiff;
|
||||
$minDiff = -$minDiff;
|
||||
}
|
||||
} else {
|
||||
$minDiff = intval( $data[0] ) * 60;
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ class SearchHighlighter {
|
|||
}
|
||||
--$contextlines;
|
||||
// truncate function changes ... to relevant i18n message.
|
||||
$pre = $contLang->truncateForVisual( $m[1], - $contextchars, '...', false );
|
||||
$pre = $contLang->truncateForVisual( $m[1], -$contextchars, '...', false );
|
||||
|
||||
if ( count( $m ) < 3 ) {
|
||||
$post = '';
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ class AllMessagesTablePager extends TablePager {
|
|||
public function formatValue( $field, $value ) {
|
||||
$linkRenderer = $this->getLinkRenderer();
|
||||
switch ( $field ) {
|
||||
case 'am_title' :
|
||||
case 'am_title':
|
||||
$title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix );
|
||||
$talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix );
|
||||
$translation = Linker::makeExternalLink(
|
||||
|
|
@ -285,8 +285,8 @@ class AllMessagesTablePager extends TablePager {
|
|||
' ' .
|
||||
$this->msg( 'parentheses' )->rawParams( $translation )->escaped();
|
||||
|
||||
case 'am_default' :
|
||||
case 'am_actual' :
|
||||
case 'am_default':
|
||||
case 'am_actual':
|
||||
return Sanitizer::escapeHtmlAllowEntities( $value );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ class LanguageBs extends Language {
|
|||
switch ( $case ) {
|
||||
case 'instrumental': # instrumental
|
||||
$word = 's ' . $word;
|
||||
break;
|
||||
break;
|
||||
case 'lokativ': # locative
|
||||
$word = 'o ' . $word;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
# this will return the original value for 'nominativ' (nominative)
|
||||
|
|
|
|||
|
|
@ -129,14 +129,14 @@ if ( is_array( $mode ) ) {
|
|||
}
|
||||
|
||||
switch ( $mode ) {
|
||||
case 'text':
|
||||
$suppressor = new TextSuppressor();
|
||||
break;
|
||||
case 'checkstyle':
|
||||
$suppressor = new CheckStyleSuppressor();
|
||||
break;
|
||||
default:
|
||||
$suppressor = new NoopSuppressor( $mode );
|
||||
case 'text':
|
||||
$suppressor = new TextSuppressor();
|
||||
break;
|
||||
case 'checkstyle':
|
||||
$suppressor = new CheckStyleSuppressor();
|
||||
break;
|
||||
default:
|
||||
$suppressor = new NoopSuppressor( $mode );
|
||||
}
|
||||
|
||||
$input = file_get_contents( 'php://stdin' );
|
||||
|
|
|
|||
Loading…
Reference in a new issue