diff options
20 files changed, 23 insertions, 50 deletions
diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php index 47c5f6597d78..89b07abdba99 100644 --- a/includes/Storage/DerivedPageDataUpdater.php +++ b/includes/Storage/DerivedPageDataUpdater.php @@ -167,9 +167,8 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface { * Stores (most of) the $options parameter of prepareUpdate(). * @see prepareUpdate() * - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-var array{changed:bool,created:bool,moved:bool,restored:bool,oldrevision:null|RevisionRecord,triggeringUser:null|UserIdentity,oldredirect:bool|null|string,oldcountable:bool|null|string,causeAction:null|string,causeAgent:null|string,editResult:null|EditResult,approved:bool} - * @codingStandardsIgnoreEnd */ private $options = [ 'changed' => true, diff --git a/includes/Storage/EditResult.php b/includes/Storage/EditResult.php index 7ffe2d6760f2..9da7e1b4b388 100644 --- a/includes/Storage/EditResult.php +++ b/includes/Storage/EditResult.php @@ -117,9 +117,8 @@ class EditResult implements JsonSerializable { * @see EditResult::jsonSerialize() * * @param array $a - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{isNew:bool,originalRevisionId:bool|int,revertMethod:int|null,newestRevertedRevId:int|null,oldestRevertedRevId:int|null,isExactRevert:bool,isNullEdit:bool,revertTags:string[],version:string} $a - * @codingStandardsIgnoreEnd * * @return EditResult * @@ -271,9 +270,8 @@ class EditResult implements JsonSerializable { * @see EditResult::newFromArray() * * @return array - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-return array{isNew:bool,originalRevisionId:bool|int,revertMethod:int|null,newestRevertedRevId:int|null,oldestRevertedRevId:int|null,isExactRevert:bool,isNullEdit:bool,revertTags:string[],version:string} - * @codingStandardsIgnoreEnd * * @since 1.36 */ diff --git a/includes/api/ApiAuthManagerHelper.php b/includes/api/ApiAuthManagerHelper.php index 61d298a8d884..af5511291220 100644 --- a/includes/api/ApiAuthManagerHelper.php +++ b/includes/api/ApiAuthManagerHelper.php @@ -317,9 +317,8 @@ class ApiAuthManagerHelper { /** * Clean up a field array for output * @param array $fields - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{type:string,options:array,value:string,label:Message,help:Message,optional:bool,sensitive:bool,skippable:bool} $fields - * @codingStandardsIgnoreEnd * @return array */ private function formatFields( array $fields ) { diff --git a/includes/auth/AuthenticationRequest.php b/includes/auth/AuthenticationRequest.php index 79b409d7db2d..e8350e0d8d42 100644 --- a/includes/auth/AuthenticationRequest.php +++ b/includes/auth/AuthenticationRequest.php @@ -259,9 +259,7 @@ abstract class AuthenticationRequest { /** * Select a request by class name. * - * @codingStandardsIgnoreStart * @phan-template T - * @codingStandardsIgnoreEnd * @param AuthenticationRequest[] $reqs * @param string $class Class name * @phan-param class-string<T> $class diff --git a/includes/changes/ChangesListFilter.php b/includes/changes/ChangesListFilter.php index d7557a7ae65d..ea0bc03d69fb 100644 --- a/includes/changes/ChangesListFilter.php +++ b/includes/changes/ChangesListFilter.php @@ -137,9 +137,8 @@ abstract class ChangesListFilter { * UI. * * $filterDefinition['priority'] int Priority integer. Higher value means higher * up in the group's filter list. - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{name:string,cssClassSuffix?:string,isRowApplicableCallable?:callable,group:ChangesListFilterGroup,label:string,description:string,priority:int} $filterDefinition - * @codingStandardsIgnoreEnd */ public function __construct( array $filterDefinition ) { if ( isset( $filterDefinition['group'] ) ) { diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index fdac21ee4e7a..5ebca9cd9cc0 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -1006,9 +1006,8 @@ class HTMLForm extends ContextSource { * - attribs: (array, optional) Additional HTML attributes. * - flags: (string|string[], optional) OOUI flags. * - framed: (boolean=true, optional) OOUI framed attribute. - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{name:string,value:string,label-message?:string|string[]|MessageSpecifier,label?:string,label-raw?:string,id?:string,attribs?:array,flags?:string|string[],framed?:bool} $data - * @codingStandardsIgnoreEnd * @return HTMLForm $this for chaining calls (since 1.20) */ public function addButton( $data ) { diff --git a/includes/http/HttpRequestFactory.php b/includes/http/HttpRequestFactory.php index 2be9ac8cfd13..2b55db843177 100644 --- a/includes/http/HttpRequestFactory.php +++ b/includes/http/HttpRequestFactory.php @@ -87,9 +87,8 @@ class HttpRequestFactory { * - password Password for HTTP Basic Authentication * - originalRequest Information about the original request (as a WebRequest object or * an associative array with 'ip' and 'userAgent'). - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{timeout?:int|string,connectTimeout?:int|string,postData?:string|array,proxy?:?string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:?string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,method?:string,logger?:\Psr\Log\LoggerInterface,username?:string,password?:string,originalRequest?:\WebRequest|array{ip:string,userAgent:string}} $options - * @codingStandardsIgnoreEnd * @param string $caller The method making this request, for profiling * @throws RuntimeException * @return MWHttpRequest diff --git a/includes/http/MWHttpRequest.php b/includes/http/MWHttpRequest.php index 71185b555aec..e365658b17e7 100644 --- a/includes/http/MWHttpRequest.php +++ b/includes/http/MWHttpRequest.php @@ -89,9 +89,8 @@ abstract class MWHttpRequest implements LoggerAwareInterface { /** * @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL * @param array $options (optional) extra params to pass (see HttpRequestFactory::create()) - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{timeout?:int|string,connectTimeout?:int|string,postData?:array,proxy?:string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,logger?:LoggerInterface,username?:string,password?:string,originalRequest?:WebRequest|array{ip:string,userAgent:string},method?:string} $options - * @codingStandardsIgnoreEnd * @param string $caller The method making this request, for profiling * @param Profiler|null $profiler An instance of the profiler for profiling, or null * @throws Exception diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index 61f26883f1a3..961c60067c97 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -458,11 +458,10 @@ abstract class FileBackend implements LoggerAwareInterface { * - b) predicted operation errors occurred and 'force' was not set * * @param array[] $ops List of operations to execute in order - * @codingStandardsIgnoreStart * @phan-param array<int,array{ignoreMissingSource?:bool,overwrite?:bool,overwriteSame?:bool,headers?:bool}> $ops * @param array $opts Batch operation options + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{force?:bool,nonLocking?:bool,nonJournaled?:bool,parallelize?:bool,bypassReadOnly?:bool,preserveCache?:bool} $opts - * @codingStandardsIgnoreEnd * @return StatusValue */ final public function doOperations( array $ops, array $opts = [] ) { @@ -700,9 +699,7 @@ abstract class FileBackend implements LoggerAwareInterface { * considered "OK" as long as no fatal errors occurred. * * @param array $ops Set of operations to execute - * @codingStandardsIgnoreStart * @phan-param list<array{op:?string,src?:string,dst?:string,ignoreMissingSource?:bool,headers?:array}> $ops - * @codingStandardsIgnoreEnd * @param array $opts Batch operation options * @phan-param array{bypassReadOnly?:bool} $opts * @return StatusValue diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index ecd6ba767a30..9b6f147a236f 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -214,9 +214,7 @@ class MultiHttpClient implements LoggerAwareInterface { * - reqTimeout : post-connection timeout per request (seconds) * - usePipelining : whether to use HTTP pipelining if possible * - maxConnsPerHost : maximum number of concurrent connections (per host) - * @codingStandardsIgnoreStart * @phan-param array{connTimeout?:int,reqTimeout?:int,usePipelining?:bool,maxConnsPerHost?:int} $opts - * @codingStandardsIgnoreEnd * @return array $reqs With response array populated for each * @throws Exception * @suppress PhanTypeInvalidDimOffset @@ -310,9 +308,8 @@ class MultiHttpClient implements LoggerAwareInterface { /** * @param array &$req HTTP request map - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{url:string,proxy?:?string,query:mixed,method:string,body:string|resource,headers:string[],stream?:resource,flags:array} $req - * @codingStandardsIgnoreEnd * @param array $opts * - connTimeout : default connection timeout * - reqTimeout : default request timeout @@ -494,9 +491,8 @@ class MultiHttpClient implements LoggerAwareInterface { * @todo Remove dependency on MediaWikiServices: use a separate HTTP client * library or copy code from PhpHttpRequest * @param array $reqs Map of HTTP request arrays - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array<int,array{url:string,query:array,method:string,body:string,proxy?:?string,headers?:string[]}> $reqs - * @codingStandardsIgnoreEnd * @param array $opts * - connTimeout : connection timeout per request (seconds) * - reqTimeout : post-connection timeout per request (seconds) diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index 0107beb1cb65..9356d24f6e5d 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -155,9 +155,7 @@ abstract class BagOStuff implements * - stats: IStatsdDataFactory instance. [optional] * - logger: Psr\Log\LoggerInterface instance. [optional] * @param array $params - * @codingStandardsIgnoreStart * @phan-param array{keyspace?:string,logger?:Psr\Log\LoggerInterface,asyncHandler?:callable} $params - * @codingStandardsIgnoreEnd */ public function __construct( array $params = [] ) { $this->keyspace = $params['keyspace'] ?? 'local'; diff --git a/includes/libs/objectcache/HashBagOStuff.php b/includes/libs/objectcache/HashBagOStuff.php index 670eb51a71bb..217d153adba6 100644 --- a/includes/libs/objectcache/HashBagOStuff.php +++ b/includes/libs/objectcache/HashBagOStuff.php @@ -49,9 +49,8 @@ class HashBagOStuff extends MediumSpecificBagOStuff { * @stable to call * @param array $params Additional parameters include: * - maxKeys : only allow this many keys (using oldest-first eviction) - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable,keyspace?:string,reportDupes?:bool,syncTimeout?:int,segmentationSize?:int,segmentedValueMaxSize?:int,maxKeys?:int} $params - * @codingStandardsIgnoreEnd */ public function __construct( $params = [] ) { $params['segmentationSize'] = $params['segmentationSize'] ?? INF; diff --git a/includes/libs/objectcache/MediumSpecificBagOStuff.php b/includes/libs/objectcache/MediumSpecificBagOStuff.php index 10ce0cb885c5..bb9d24c6a54d 100644 --- a/includes/libs/objectcache/MediumSpecificBagOStuff.php +++ b/includes/libs/objectcache/MediumSpecificBagOStuff.php @@ -85,9 +85,8 @@ abstract class MediumSpecificBagOStuff extends BagOStuff { * This should be configured to a reasonable size give the site traffic and the * amount of I/O between application and cache servers that the network can handle. * @param array $params - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable,reportDupes?:bool,syncTimeout?:int,segmentationSize?:int,segmentedValueMaxSize?:int} $params - * @codingStandardsIgnoreEnd */ public function __construct( array $params = [] ) { parent::__construct( $params ); diff --git a/includes/libs/objectcache/wancache/WANObjectCache.php b/includes/libs/objectcache/wancache/WANObjectCache.php index 406359cafd1d..e43bfc971465 100644 --- a/includes/libs/objectcache/wancache/WANObjectCache.php +++ b/includes/libs/objectcache/wancache/WANObjectCache.php @@ -696,9 +696,8 @@ class WANObjectCache implements * - version: Integer version number signifiying the format of the value. * Default: null * - walltime: How long the value took to generate in seconds. Default: null - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{lag?:int,since?:int,pending?:bool,lockTSE?:int,staleTTL?:int,creating?:bool,version?:int,walltime?:int|float} $opts - * @codingStandardsIgnoreEnd * @note Options added in 1.28: staleTTL * @note Options added in 1.33: creating * @note Options added in 1.34: version, walltime @@ -1397,9 +1396,8 @@ class WANObjectCache implements * to query for dependency timestamps. The use of "pcTTL" reduces timestamp queries. * Default: null. * @param array $cbParams Custom field/value map to pass to the callback (since 1.35) - * @codingStandardsIgnoreStart + * @phpcs:ignore Generic.Files.LineLength * @phan-param array{checkKeys?:string[],graceTTL?:int,lockTSE?:int,busyValue?:mixed,pcTTL?:int,pcGroup?:string,version?:int,minAsOf?:float|int,hotTTR?:int,lowTTL?:int,ageNew?:int,staleTTL?:int,touchedCallback?:callable} $opts - * @codingStandardsIgnoreEnd * @return mixed Value found or written to the key * @note Options added in 1.28: version, busyValue, hotTTR, ageNew, pcGroup, minAsOf * @note Options added in 1.31: staleTTL, graceTTL diff --git a/includes/mail/IEmailer.php b/includes/mail/IEmailer.php index 3356134f6f80..d210e06b4603 100644 --- a/includes/mail/IEmailer.php +++ b/includes/mail/IEmailer.php @@ -48,9 +48,7 @@ interface IEmailer { * 'contentType' string default 'text/plain; charset=UTF-8' * 'headers' array Extra headers to set * - * @codingStandardsIgnoreStart * @phan-param array{replyTo?:MailAddress,contentType?:string,headers?:array<string,string>} $options - * @codingStandardsIgnoreEnd * * @throws MWException * @throws Exception diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index da98c25236ee..b96f66f0b840 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1545,9 +1545,7 @@ MESSAGE; * - string|null: Module group (optional) * - string|null: Name of foreign module source, or 'local' (optional) * - string|null: Script body of a skip function (optional) - * @codingStandardsIgnoreStart * @phan-param array<int,array{0:string,1:string,2?:?array,3?:?string,4?:?string,5?:?string}> $modules - * @codingStandardsIgnoreEnd * @return string JavaScript code */ public static function makeLoaderRegisterScript( diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 7927895e0281..cbd331ae1a64 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -123,9 +123,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { * - array 'dependencies' * - string|null 'group' * - string 'source' - * @codingStandardsIgnoreStart * @phan-param array<string,array{version:string,dependencies:array,group:?string,source:string}> &$registryData - * @codingStandardsIgnoreEnd */ public static function compileUnresolvedDependencies( array &$registryData ) : void { foreach ( $registryData as $name => &$data ) { diff --git a/tests/phpunit/includes/ContentSecurityPolicyTest.php b/tests/phpunit/includes/ContentSecurityPolicyTest.php index d8c7ad0fdc07..bc492aeb660c 100644 --- a/tests/phpunit/includes/ContentSecurityPolicyTest.php +++ b/tests/phpunit/includes/ContentSecurityPolicyTest.php @@ -162,7 +162,7 @@ class ContentSecurityPolicyTest extends MediaWikiIntegrationTestCase { } public function providerMakeCSPDirectives() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ false, '', '' ], [ @@ -262,6 +262,7 @@ class ContentSecurityPolicyTest extends MediaWikiIntegrationTestCase { "script-src 'unsafe-eval' blob: 'self' 'nonce-secret' 'unsafe-inline' sister-site.somewhere.com *.wikipedia.org; default-src * data: blob:; style-src * data: blob: 'unsafe-inline'; object-src 'self' https://example.com/f%3Bd; report-uri /w/api.php?action=cspreport&format=json&reportonly=1", ], ]; + // phpcs:enable } /** @@ -275,6 +276,7 @@ class ContentSecurityPolicyTest extends MediaWikiIntegrationTestCase { $wgAllowImageTag = $origImg; + // phpcs:ignore Generic.Files.LineLength $expected = "script-src 'unsafe-eval' blob: 'self' 'nonce-secret' 'unsafe-inline' sister-site.somewhere.com *.wikipedia.org; default-src * data: blob:; style-src * data: blob: 'unsafe-inline'; object-src 'none'; report-uri /w/api.php?action=cspreport&format=json"; $this->assertSame( $expected, $actual ); } @@ -287,9 +289,9 @@ class ContentSecurityPolicyTest extends MediaWikiIntegrationTestCase { true, ContentSecurityPolicy::REPORT_ONLY_MODE ); + // phpcs:ignore Generic.Files.LineLength $expected = "script-src 'unsafe-eval' blob: 'self' 'nonce-secret' 'unsafe-inline' sister-site.somewhere.com *.wikipedia.org; default-src * data: blob:; style-src * data: blob: 'unsafe-inline'; object-src 'none'; report-uri /w/api.php?action=cspreport&format=json&reportonly=1"; $this->assertSame( $expected, $actual ); - // @codingStandardsIgnoreEnd Generic.Files.LineLength } /** diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 5599fbecfce7..15e564c9849b 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -21,13 +21,13 @@ class OutputPageTest extends MediaWikiIntegrationTestCase { private const SCREEN_MEDIA_QUERY = 'screen and (min-width: 982px)'; private const SCREEN_ONLY_MEDIA_QUERY = 'only screen and (min-width: 982px)'; - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength private const RSS_RC_LINK = '<link rel="alternate" type="application/rss+xml" title=" RSS feed" href="/w/index.php?title=Special:RecentChanges&feed=rss"/>'; private const ATOM_RC_LINK = '<link rel="alternate" type="application/atom+xml" title=" Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"/>'; private const RSS_TEST_LINK = '<link rel="alternate" type="application/rss+xml" title=""Test" RSS feed" href="fake-link"/>'; private const ATOM_TEST_LINK = '<link rel="alternate" type="application/atom+xml" title=""Test" Atom feed" href="fake-link"/>'; - // @codingStandardsIgnoreEnd + // phpcs:enable // Ensure that we don't affect the global ResourceLoader state. protected function setUp() : void { diff --git a/tests/phpunit/unit/includes/resourceloader/VueComponentParserTest.php b/tests/phpunit/unit/includes/resourceloader/VueComponentParserTest.php index e2c82011f103..8cc956c1f628 100644 --- a/tests/phpunit/unit/includes/resourceloader/VueComponentParserTest.php +++ b/tests/phpunit/unit/includes/resourceloader/VueComponentParserTest.php @@ -18,7 +18,7 @@ class VueComponentParserTest extends PHPUnit\Framework\TestCase { } public static function provideTestParse() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ [ '<template><p>{{foo}}</p></template><script>bar</script><style>baz</style>', @@ -328,6 +328,6 @@ class VueComponentParserTest extends PHPUnit\Framework\TestCase { 'Template with self-closing tag (broken)' ], ]; - // @codingStandardsIgnoreEnd Generic.Files.LineLength + // phpcs:enable } } |