Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 8.4?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically CI on MW master passes on 8.4 today. I'm slightly unsure if we should add that as official support yet. Or maybe that's good enough.

* [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].
Expand Down
3 changes: 0 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
<testsuite name="TestExampleRules">
<file>tests/TestExampleRules.php</file>
</testsuite>
<testsuite name="MediaWiki">
<directory>tests/MediaWiki</directory>
</testsuite>
Expand Down
3 changes: 1 addition & 2 deletions src/DataAccess/PageContentFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/DataAccess/RulesDeserializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? []
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 !== '' );
}

}
2 changes: 1 addition & 1 deletion src/Domain/TemplateSegment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 2 additions & 4 deletions src/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/MediaWiki/AutomatedValuesMwTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
);
}
Expand Down
Loading