diff --git a/.phpcs.xml b/.phpcs.xml index eddb6dc85..9be92f2d5 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,6 +1,14 @@ + + + + + + /src/ResourceLoader/ + + . diff --git a/src/Cite.php b/src/Cite.php index e4374f718..1c5e2d460 100644 --- a/src/Cite.php +++ b/src/Cite.php @@ -31,6 +31,9 @@ use MediaWiki\Parser\Sanitizer; use Parser; use StatusValue; +/** + * @license GPL-2.0-or-later + */ class Cite { public const DEFAULT_GROUP = ''; diff --git a/src/Hooks/CiteHooks.php b/src/Hooks/CiteHooks.php index bfbaad9e4..6d9d4c857 100644 --- a/src/Hooks/CiteHooks.php +++ b/src/Hooks/CiteHooks.php @@ -19,6 +19,7 @@ use MediaWiki\Title\Title; use MediaWiki\User\Options\UserOptionsLookup; /** + * @license GPL-2.0-or-later * @phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName */ class CiteHooks implements diff --git a/src/ReferenceMessageLocalizer.php b/src/ReferenceMessageLocalizer.php index 95d0a974c..717dfe1ed 100644 --- a/src/ReferenceMessageLocalizer.php +++ b/src/ReferenceMessageLocalizer.php @@ -9,6 +9,8 @@ use MessageSpecifier; /** * Interface abstracts everything a Cite needs to do with languages. + * + * @license GPL-2.0-or-later */ class ReferenceMessageLocalizer implements MessageLocalizer { diff --git a/src/Validator.php b/src/Validator.php index 5bd7a07ae..2a5f33c3e 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -5,6 +5,9 @@ namespace Cite; use MediaWiki\Parser\Sanitizer; use StatusValue; +/** + * @license GPL-2.0-or-later + */ class Validator { private ReferenceStack $referenceStack; diff --git a/tests/phpunit/ReferenceMessageLocalizerTest.php b/tests/phpunit/ReferenceMessageLocalizerTest.php index 3d59d8fd5..245dad097 100644 --- a/tests/phpunit/ReferenceMessageLocalizerTest.php +++ b/tests/phpunit/ReferenceMessageLocalizerTest.php @@ -7,6 +7,7 @@ use LanguageQqx; /** * @covers \Cite\ReferenceMessageLocalizer + * @license GPL-2.0-or-later */ class ReferenceMessageLocalizerTest extends \MediaWikiIntegrationTestCase { diff --git a/tests/phpunit/integration/AnchorFormatterTest.php b/tests/phpunit/integration/AnchorFormatterTest.php index 935836358..fad1bf3c0 100644 --- a/tests/phpunit/integration/AnchorFormatterTest.php +++ b/tests/phpunit/integration/AnchorFormatterTest.php @@ -9,8 +9,7 @@ use Message; use Wikimedia\TestingAccessWrapper; /** - * @coversDefaultClass \Cite\AnchorFormatter - * + * @covers \Cite\AnchorFormatter * @license GPL-2.0-or-later */ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase { @@ -20,10 +19,6 @@ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase { $this->overrideConfigValue( 'FragmentMode', [ 'html5' ] ); } - /** - * @covers ::refKey - * @covers ::backLink - */ public function testRefKey() { $mockMessageLocalizer = $this->createMock( ReferenceMessageLocalizer::class ); $mockMessageLocalizer->method( 'msg' )->willReturnCallback( @@ -43,10 +38,6 @@ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase { $formatter->backLink( 'key', '2' ) ); } - /** - * @covers ::getReferencesKey - * @covers ::jumpLink - */ public function testGetReferencesKey() { $mockMessageLocalizer = $this->createMock( ReferenceMessageLocalizer::class ); $mockMessageLocalizer->method( 'msg' )->willReturnCallback( @@ -64,8 +55,6 @@ class AnchorFormatterTest extends \MediaWikiIntegrationTestCase { } /** - * @covers ::normalizeKey - * @covers ::__construct * @dataProvider provideKeyNormalizations */ public function testNormalizeKey( $key, $expected ) { diff --git a/tests/phpunit/integration/CiteTest.php b/tests/phpunit/integration/CiteTest.php index 0f12b6562..12d9e354c 100644 --- a/tests/phpunit/integration/CiteTest.php +++ b/tests/phpunit/integration/CiteTest.php @@ -17,7 +17,6 @@ use Wikimedia\TestingAccessWrapper; /** * @coversDefaultClass \Cite\Cite - * * @license GPL-2.0-or-later */ class CiteTest extends \MediaWikiIntegrationTestCase { diff --git a/tests/phpunit/integration/FootnoteMarkFormatterTest.php b/tests/phpunit/integration/FootnoteMarkFormatterTest.php index 2a32d8627..99001ed2d 100644 --- a/tests/phpunit/integration/FootnoteMarkFormatterTest.php +++ b/tests/phpunit/integration/FootnoteMarkFormatterTest.php @@ -11,13 +11,12 @@ use Parser; use Wikimedia\TestingAccessWrapper; /** - * @coversDefaultClass \Cite\FootnoteMarkFormatter + * @covers \Cite\FootnoteMarkFormatter + * @license GPL-2.0-or-later */ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase { /** - * @covers ::linkRef - * @covers ::__construct * @dataProvider provideLinkRef */ public function testLinkRef( string $group, array $ref, string $expectedOutput ) { @@ -132,8 +131,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase { } /** - * @covers ::getLinkLabel - * * @dataProvider provideGetLinkLabel */ public function testGetLinkLabel( $expectedLabel, $offset, $group, $labelList ) { diff --git a/tests/phpunit/integration/ValidatorTest.php b/tests/phpunit/integration/ValidatorTest.php index 582ca11f1..f7514fe8e 100644 --- a/tests/phpunit/integration/ValidatorTest.php +++ b/tests/phpunit/integration/ValidatorTest.php @@ -9,7 +9,6 @@ use Wikimedia\TestingAccessWrapper; /** * @covers \Cite\Validator - * * @license GPL-2.0-or-later */ class ValidatorTest extends \MediaWikiIntegrationTestCase { diff --git a/tests/phpunit/unit/CitationToolDefinitionTest.php b/tests/phpunit/unit/CitationToolDefinitionTest.php index cc9913ca1..c0bc1cc32 100644 --- a/tests/phpunit/unit/CitationToolDefinitionTest.php +++ b/tests/phpunit/unit/CitationToolDefinitionTest.php @@ -8,7 +8,6 @@ use Message; /** * @covers \Cite\ResourceLoader\CitationToolDefinition - * * @license GPL-2.0-or-later */ class CitationToolDefinitionTest extends \MediaWikiUnitTestCase { diff --git a/tests/phpunit/unit/CiteHooksUnitTest.php b/tests/phpunit/unit/CiteHooksUnitTest.php index 6307485de..a487b8e41 100644 --- a/tests/phpunit/unit/CiteHooksUnitTest.php +++ b/tests/phpunit/unit/CiteHooksUnitTest.php @@ -8,7 +8,6 @@ use MediaWiki\User\Options\StaticUserOptionsLookup; /** * @covers \Cite\Hooks\CiteHooks - * * @license GPL-2.0-or-later */ class CiteHooksUnitTest extends \MediaWikiUnitTestCase { diff --git a/tests/phpunit/unit/CiteParserHooksTest.php b/tests/phpunit/unit/CiteParserHooksTest.php index aa97d18ad..ef546db38 100644 --- a/tests/phpunit/unit/CiteParserHooksTest.php +++ b/tests/phpunit/unit/CiteParserHooksTest.php @@ -10,15 +10,11 @@ use ParserOutput; use StripState; /** - * @coversDefaultClass \Cite\Hooks\CiteParserHooks - * + * @covers \Cite\Hooks\CiteParserHooks * @license GPL-2.0-or-later */ class CiteParserHooksTest extends \MediaWikiUnitTestCase { - /** - * @covers ::onParserFirstCallInit - */ public function testOnParserFirstCallInit() { $parser = $this->createNoOpMock( Parser::class, [ 'setHook' ] ); $expectedTags = [ 'ref' => true, 'references' => true ]; @@ -33,9 +29,6 @@ class CiteParserHooksTest extends \MediaWikiUnitTestCase { $citeParserHooks->onParserFirstCallInit( $parser ); } - /** - * @covers ::onParserClearState - */ public function testOnParserClearState() { $parser = $this->createParser(); $parser->extCite = $this->createMock( Cite::class ); @@ -46,9 +39,6 @@ class CiteParserHooksTest extends \MediaWikiUnitTestCase { $this->assertObjectNotHasProperty( 'extCite', $parser ); } - /** - * @covers ::onParserCloned - */ public function testOnParserCloned() { $parser = $this->createParser(); $parser->extCite = $this->createMock( Cite::class ); @@ -59,9 +49,6 @@ class CiteParserHooksTest extends \MediaWikiUnitTestCase { $this->assertObjectNotHasProperty( 'extCite', $parser ); } - /** - * @covers ::onParserAfterParse - */ public function testAfterParseHooks() { $cite = $this->createMock( Cite::class ); $cite->expects( $this->once() ) diff --git a/tests/phpunit/unit/CiteParserTagHooksTest.php b/tests/phpunit/unit/CiteParserTagHooksTest.php index 7fde7555a..d8647e4f1 100644 --- a/tests/phpunit/unit/CiteParserTagHooksTest.php +++ b/tests/phpunit/unit/CiteParserTagHooksTest.php @@ -9,15 +9,11 @@ use ParserOutput; use PPFrame; /** - * @coversDefaultClass \Cite\Hooks\CiteParserTagHooks - * + * @covers \Cite\Hooks\CiteParserTagHooks * @license GPL-2.0-or-later */ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase { - /** - * @covers ::register - */ public function testRegister() { $parser = $this->createNoOpMock( Parser::class, [ 'setHook' ] ); $expectedTags = [ 'ref' => true, 'references' => true ]; @@ -31,9 +27,6 @@ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase { CiteParserTagHooks::register( $parser ); } - /** - * @covers ::ref - */ public function testRef_fails() { $cite = $this->createMock( Cite::class ); $cite->method( 'ref' ) @@ -48,10 +41,6 @@ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase { $this->assertSame( '<ref></ref>', $html ); } - /** - * @covers ::citeForParser - * @covers ::ref - */ public function testRef() { $cite = $this->createMock( Cite::class ); $cite->expects( $this->once() ) @@ -75,9 +64,6 @@ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase { $this->assertSame( '', $html ); } - /** - * @covers ::references - */ public function testReferences_fails() { $cite = $this->createMock( Cite::class ); $cite->method( 'references' ) @@ -92,10 +78,6 @@ class CiteParserTagHooksTest extends \MediaWikiUnitTestCase { $this->assertSame( '<references/>', $html ); } - /** - * @covers ::citeForParser - * @covers ::references - */ public function testReferences() { $cite = $this->createMock( Cite::class ); $cite->expects( $this->once() ) diff --git a/tests/phpunit/unit/ErrorReporterTest.php b/tests/phpunit/unit/ErrorReporterTest.php index 660cb0e6b..32ab597e9 100644 --- a/tests/phpunit/unit/ErrorReporterTest.php +++ b/tests/phpunit/unit/ErrorReporterTest.php @@ -11,7 +11,6 @@ use ParserOptions; /** * @covers \Cite\ErrorReporter - * * @license GPL-2.0-or-later */ class ErrorReporterTest extends \MediaWikiUnitTestCase { diff --git a/tests/phpunit/unit/ReferenceMessageLocalizerUnitTest.php b/tests/phpunit/unit/ReferenceMessageLocalizerUnitTest.php index a745ebd6b..7bbd67ff4 100644 --- a/tests/phpunit/unit/ReferenceMessageLocalizerUnitTest.php +++ b/tests/phpunit/unit/ReferenceMessageLocalizerUnitTest.php @@ -6,14 +6,11 @@ use Cite\ReferenceMessageLocalizer; use Language; /** - * @coversDefaultClass \Cite\ReferenceMessageLocalizer + * @covers \Cite\ReferenceMessageLocalizer + * @license GPL-2.0-or-later */ class ReferenceMessageLocalizerUnitTest extends \MediaWikiUnitTestCase { - /** - * @covers ::localizeSeparators - * @covers ::__construct - */ public function testLocalizeSeparators() { $mockLanguage = $this->createNoOpMock( Language::class, [ 'separatorTransformTable' ] ); $mockLanguage->method( 'separatorTransformTable' )->willReturn( [ '.' => ',', '0' => '' ] ); @@ -21,9 +18,6 @@ class ReferenceMessageLocalizerUnitTest extends \MediaWikiUnitTestCase { $this->assertSame( '10,0', $messageLocalizer->localizeSeparators( '10.0' ) ); } - /** - * @covers ::localizeDigits - */ public function testLocalizeDigits() { $mockLanguage = $this->createNoOpMock( Language::class, [ 'formatNumNoSeparators' ] ); $mockLanguage->method( 'formatNumNoSeparators' )->willReturnArgument( 0 ); diff --git a/tests/phpunit/unit/ReferenceStackTest.php b/tests/phpunit/unit/ReferenceStackTest.php index 109550ee3..7c3a2c7eb 100644 --- a/tests/phpunit/unit/ReferenceStackTest.php +++ b/tests/phpunit/unit/ReferenceStackTest.php @@ -10,16 +10,11 @@ use StripState; use Wikimedia\TestingAccessWrapper; /** - * @coversDefaultClass \Cite\ReferenceStack - * + * @covers \Cite\ReferenceStack * @license GPL-2.0-or-later */ class ReferenceStackTest extends \MediaWikiUnitTestCase { - /** - * @covers ::__construct - * @covers ::pushInvalidRef - */ public function testPushInvalidRef() { $stack = $this->newStack(); @@ -29,7 +24,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { } /** - * @covers ::pushRef * @dataProvider providePushRef */ public function testPushRefs( @@ -824,8 +818,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { } /** - * @covers ::rollbackRefs - * @covers ::rollbackRef * @dataProvider provideRollbackRefs */ public function testRollbackRefs( @@ -982,9 +974,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ]; } - /** - * @covers ::rollbackRef - */ public function testRollbackRefs_extends() { $stack = $this->newStack(); @@ -1003,9 +992,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { $this->assertSame( 0, $stack->extendsCount['foo']['a'] ); } - /** - * @covers ::popGroup - */ public function testRemovals() { $stack = $this->newStack(); $stack->refs = [ 'group1' => [], 'group2' => [] ]; @@ -1014,9 +1000,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { $this->assertSame( [ 'group2' => [] ], $stack->refs ); } - /** - * @covers ::getGroups - */ public function testGetGroups() { $stack = $this->newStack(); $stack->refs = [ 'havenot' => [], 'have' => [ [ 'ref etc' ] ] ]; @@ -1024,9 +1007,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { $this->assertSame( [ 'have' ], $stack->getGroups() ); } - /** - * @covers ::hasGroup - */ public function testHasGroup() { $stack = $this->newStack(); $stack->refs = [ 'present' => [ [ 'ref etc' ] ], 'empty' => [] ]; @@ -1036,9 +1016,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { $this->assertFalse( $stack->hasGroup( 'empty' ) ); } - /** - * @covers ::getGroupRefs - */ public function testGetGroupRefs() { $stack = $this->newStack(); $stack->refs = [ 'present' => [ [ 'ref etc' ] ], 'empty' => [] ]; @@ -1048,9 +1025,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { $this->assertSame( [], $stack->getGroupRefs( 'empty' ) ); } - /** - * @covers ::appendText - */ public function testAppendText() { $stack = $this->newStack(); diff --git a/tests/phpunit/unit/ReferencesFormatterTest.php b/tests/phpunit/unit/ReferencesFormatterTest.php index 27bc57987..4afb531b3 100644 --- a/tests/phpunit/unit/ReferencesFormatterTest.php +++ b/tests/phpunit/unit/ReferencesFormatterTest.php @@ -11,16 +11,12 @@ use Parser; use Wikimedia\TestingAccessWrapper; /** - * @coversDefaultClass \Cite\ReferencesFormatter - * + * @covers \Cite\ReferencesFormatter * @license GPL-2.0-or-later */ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { /** - * @covers ::__construct - * @covers ::formatReferences - * @covers ::formatRefsList * @dataProvider provideFormatReferences */ public function testFormatReferences( array $refs, string $expectedOutput ) { @@ -160,7 +156,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::closeIndention * @dataProvider provideCloseIndention */ public function testCloseIndention( $closingLi, $expectedOutput ) { @@ -184,7 +179,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::formatListItem * @dataProvider provideFormatListItem */ public function testFormatListItem( @@ -290,7 +284,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::referenceText * @dataProvider provideReferenceText */ public function testReferenceText( @@ -346,7 +339,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::referencesFormatEntryAlternateBacklinkLabel * @dataProvider provideReferencesFormatEntryAlternateBacklinkLabel */ public function testReferencesFormatEntryAlternateBacklinkLabel( @@ -386,7 +378,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::referencesFormatEntryNumericBacklinkLabel * @dataProvider provideReferencesFormatEntryNumericBacklinkLabel */ public function testReferencesFormatEntryNumericBacklinkLabel( @@ -416,7 +407,6 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { } /** - * @covers ::listToText * @dataProvider provideLists */ public function testListToText( array $list, $expected ) {