From e8fd6c093f91c290e92fe36581a0ae9c1514ddd1 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Mon, 26 Aug 2024 11:12:48 +0200 Subject: [PATCH] Rename internal BOOK_REF_ATTRIBUTE constant This has no user-facing consequences. The constant can be renamed any time again, if needed. It's not used anywhere else: https://codesearch.wmcloud.org/search/?q=BOOK_REF_ATTRIBUTE Bug: T373307 Change-Id: Ia4d588e926bb6e75f96048f2d3782c0f23ece514 --- src/Cite.php | 12 +++++------- tests/phpunit/integration/CiteTest.php | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Cite.php b/src/Cite.php index 89acd94ba..39c87306e 100644 --- a/src/Cite.php +++ b/src/Cite.php @@ -38,10 +38,8 @@ class Cite { public const DEFAULT_GROUP = ''; - /** - * Wikitext attribute name for Book Referencing. - */ - public const BOOK_REF_ATTRIBUTE = 'extends'; + /** Attribute name for the sub-referencing feature in */ + public const SUBREF_ATTRIBUTE = 'extends'; /** * Message key for the (localized) tracking category for pages using the `extends` attribute. @@ -123,15 +121,15 @@ class Cite { ?string $text, array $argv ): string { - // Tag every page where Book Referencing has been used, whether or not the ref tag is valid. + // Tag every page where sub-referencing has been used, whether or not the ref tag is valid. // TODO: Remove this generic usage tracking once the feature is stable. See T237531. - if ( array_key_exists( self::BOOK_REF_ATTRIBUTE, $argv ) ) { + if ( array_key_exists( self::SUBREF_ATTRIBUTE, $argv ) ) { $parser->addTrackingCategory( self::EXTENDS_TRACKING_CATEGORY ); } $status = $this->parseArguments( $argv, - [ 'group', 'name', self::BOOK_REF_ATTRIBUTE, 'follow', 'dir' ] + [ 'group', 'name', self::SUBREF_ATTRIBUTE, 'follow', 'dir' ] ); $arguments = $status->getValue(); // Use the default group, or the references group when inside one. diff --git a/tests/phpunit/integration/CiteTest.php b/tests/phpunit/integration/CiteTest.php index 7a34f83d8..7bc98f998 100644 --- a/tests/phpunit/integration/CiteTest.php +++ b/tests/phpunit/integration/CiteTest.php @@ -418,7 +418,7 @@ class CiteTest extends \MediaWikiIntegrationTestCase { $spy = TestingAccessWrapper::newFromObject( $cite ); $spy->errorReporter = $this->createMock( ErrorReporter::class ); - $spy->guardedRef( $mockParser, 'text', [ Cite::BOOK_REF_ATTRIBUTE => 'a' ] ); + $spy->guardedRef( $mockParser, 'text', [ Cite::SUBREF_ATTRIBUTE => 'a' ] ); } /**