From e7a6054fb92dad2bb2f4c32a737b1ed30e3ad47b Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Tue, 25 Feb 2025 15:06:19 +0200 Subject: [PATCH 1/5] Update CI --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b44e320..be8d58d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,18 +7,35 @@ on: jobs: test: name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}" + continue-on-error: ${{ matrix.experimental }} strategy: matrix: include: - mw: 'REL1_36' php: 8.0 + experimental: false - mw: 'REL1_37' php: 8.0 + experimental: false - mw: 'REL1_38' php: 8.0 + experimental: false - mw: 'REL1_39' php: 8.0 + experimental: false + - mw: 'REL1_41' + php: 8.1 + experimental: false + - mw: 'REL1_42' + php: 8.2 + experimental: false + - mw: 'REL1_43' + php: 8.3 + experimental: false + - mw: 'master' + php: 8.4 + experimental: true runs-on: ubuntu-latest From 1f1130a9787c231a33b4cf61ae0d31260cb45ae1 Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Tue, 25 Feb 2025 15:35:28 +0200 Subject: [PATCH 2/5] Remove missing test suite --- phpunit.xml.dist | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 64d3101..9f73bc4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,9 +6,6 @@ tests/Integration - - tests/TestExampleRules.php - tests/MediaWiki From 11b0dfbb2157928f120e78757d9638a89d4dcd33 Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Tue, 25 Feb 2025 15:35:52 +0200 Subject: [PATCH 3/5] Replace serialize method --- tests/MediaWiki/AutomatedValuesMwTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/MediaWiki/AutomatedValuesMwTestCase.php b/tests/MediaWiki/AutomatedValuesMwTestCase.php index dbc9fb8..f04dbbc 100644 --- a/tests/MediaWiki/AutomatedValuesMwTestCase.php +++ b/tests/MediaWiki/AutomatedValuesMwTestCase.php @@ -20,7 +20,7 @@ protected function privateSaveAndLoadProperty( Property $property ): Property { private function saveProperty( Property $property ) { $this->insertPage( - 'Property:' . $property->getId()->serialize(), + 'Property:' . $property->getId()->getSerialization(), json_encode( $this->getPropertySerializer()->serialize( $property ) ) ); } From c5d62b56b7c268a2ce5b47fdd3f7fd437afd18be Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Tue, 25 Feb 2025 15:38:12 +0200 Subject: [PATCH 4/5] Fix CS --- src/DataAccess/PageContentFetcher.php | 3 +-- src/DataAccess/RulesDeserializer.php | 2 +- src/Domain/Template.php | 4 ++-- src/Domain/TemplateSegment.php | 2 +- src/Hooks.php | 6 ++---- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/DataAccess/PageContentFetcher.php b/src/DataAccess/PageContentFetcher.php index 95d12c0..73e00a8 100644 --- a/src/DataAccess/PageContentFetcher.php +++ b/src/DataAccess/PageContentFetcher.php @@ -19,8 +19,7 @@ public function __construct( \TitleParser $titleParser, RevisionLookup $revision public function getPageContent( string $pageTitle ): ?\Content { try { $title = $this->titleParser->parseTitle( $pageTitle ); - } - catch ( \MalformedTitleException $e ) { + } catch ( \MalformedTitleException $e ) { return null; } diff --git a/src/DataAccess/RulesDeserializer.php b/src/DataAccess/RulesDeserializer.php index f2269ec..d2e33b9 100644 --- a/src/DataAccess/RulesDeserializer.php +++ b/src/DataAccess/RulesDeserializer.php @@ -61,7 +61,7 @@ private function newRules( array $arrayRules ): Rules { private function newEntityCriteria( array $arrayRule ): EntityCriteria { return new EntityCriteria( ...array_map( - fn( array $criterion ) => new StatementEqualityCriterion( Compat::newPId( $criterion['statement'] ), new StringValue( $criterion['equalTo'] ) ), + fn ( array $criterion ) => new StatementEqualityCriterion( Compat::newPId( $criterion['statement'] ), new StringValue( $criterion['equalTo'] ) ), $arrayRule['when'] ?? [] ) ); diff --git a/src/Domain/Template.php b/src/Domain/Template.php index 273ad0c..ab51087 100644 --- a/src/Domain/Template.php +++ b/src/Domain/Template.php @@ -41,7 +41,7 @@ public function buildValues( StatementList $statements ): array { public function supportsMultipleValues(): bool { return count( array_unique( array_map( - fn( TemplateSegment $s ) => $s->statementPropertyId, + fn ( TemplateSegment $s ) => $s->statementPropertyId, $this->segments ) ) ) === 1; @@ -57,7 +57,7 @@ private function buildMultipleValues( StatementList $statements ): array { $values[] = $this->buildValue( new StatementList( $statement ) ); } - return array_filter( $values, fn( string $s ) => $s !== '' ); + return array_filter( $values, fn ( string $s ) => $s !== '' ); } } diff --git a/src/Domain/TemplateSegment.php b/src/Domain/TemplateSegment.php index f8e9d0f..99ef1f7 100644 --- a/src/Domain/TemplateSegment.php +++ b/src/Domain/TemplateSegment.php @@ -51,7 +51,7 @@ private function getValuesForSegment( StatementList $statements ): array { $values[] = $this->getValueFromSegment( $statement ); } - return array_filter( $values, fn( $v ) => $v !== null ); + return array_filter( $values, fn ( $v ) => $v !== null ); } private function getValueFromSegment( Statement $statement ): ?DataValue { diff --git a/src/Hooks.php b/src/Hooks.php index 2258fbf..047c677 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -18,15 +18,13 @@ class Hooks { public static function onMultiContentSave( RenderedRevision $renderedRevision ): void { try { $content = $renderedRevision->getRevision()->getSlot( 'main' )->getContent(); - } - catch ( RevisionAccessException $ex ) { + } catch ( RevisionAccessException $ex ) { } if ( isset( $content ) && $content instanceof EntityContent ) { try { $entity = $content->getEntity(); - } - catch ( \Exception $ex ) { + } catch ( \Exception $ex ) { } if ( isset( $entity ) && $entity instanceof StatementListProvidingEntity ) { From 7e6499b4f8ef7d490ba347ef801a03c7c1c03912 Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Tue, 25 Feb 2025 15:49:44 +0200 Subject: [PATCH 5/5] Update readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50c79bc..002934b 100644 --- a/README.md +++ b/README.md @@ -186,9 +186,9 @@ Rules are applied in order. In other words, the second Rule can override values Platform requirements: -* [PHP] 7.4 or later (tested up to 8.0) -* [MediaWiki] 1.35 or later (tested up to 1.37) -* [Wikibase] 1.35 or later (tested up to 1.37) +* [PHP] 7.4 or later (tested up to 8.3) +* [MediaWiki] 1.35 or later (tested up to 1.43) +* [Wikibase] 1.35 or later (tested up to 1.43) The recommended way to install Automated Values is using [Composer] with [MediaWiki's built-in support for Composer][Composer install].