Skip to content

Commit b1fd0ac

Browse files
authored
Merge pull request #101 from codders/feat/upgrade-mediawiki-codesniffer-20241206
Upgrade mediawiki-codesniffer to latest version (45.0.0)
2 parents 628018f + 06415a0 commit b1fd0ac

File tree

12 files changed

+24
-16
lines changed

12 files changed

+24
-16
lines changed

.github/workflows/php.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php:
16-
- '7.2'
17-
- '7.3'
1816
- '7.4'
1917

2018
steps:

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"irc": "irc://irc.freenode.net/wikidata"
2424
},
2525
"require": {
26-
"php": ">=7.2.0",
26+
"php": ">=7.4",
2727
"data-values/data-values": "~3.0|~2.0|~1.0|~0.1",
2828
"data-values/interfaces": "~1.0|~0.2.0"
2929
},
3030
"require-dev": {
3131
"phpunit/phpunit": "~8.0",
3232
"ockcyp/covers-validator": "^1.3.3",
33-
"mediawiki/mediawiki-codesniffer": "^34"
33+
"mediawiki/mediawiki-codesniffer": "^45"
3434
},
3535
"extra": {
3636
"branch-alias": {
@@ -67,5 +67,10 @@
6767
"@cs",
6868
"@test"
6969
]
70+
},
71+
"config": {
72+
"allow-plugins": {
73+
"dealerdirect/phpcodesniffer-composer-installer": true
74+
}
7075
}
7176
}

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
<exclude name="Generic.Files.LineLength.TooLong" />
88
<exclude name="Generic.Files.LineLength.MaxExceeded" />
99
</rule>
10+
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
1011
</ruleset>

src/DataValues/MonolingualTextValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function unserialize( $value ) {
6565
}
6666

6767
public function __unserialize( array $data ): void {
68-
list( $languageCode, $text ) = $data;
68+
[ $languageCode, $text ] = $data;
6969
$this->__construct( $languageCode, $text );
7070
}
7171

src/ValueFormatters/Exceptions/MismatchingDataValueTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(
3636
$expectedValueType,
3737
$dataValueType,
3838
$message = '',
39-
Exception $previous = null
39+
?Exception $previous = null
4040
) {
4141
$this->expectedValueType = $expectedValueType;
4242
$this->dataValueType = $dataValueType;

src/ValueParsers/BoolParser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class BoolParser extends StringValueParser {
1818

1919
private const FORMAT_NAME = 'bool';
2020

21+
/**
22+
* @var Mapping from possible string values to their
23+
* boolean equivalents
24+
*/
2125
private static $values = [
2226
'yes' => true,
2327
'on' => true,

src/ValueParsers/StringParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StringParser implements ValueParser {
2626
/**
2727
* @param StringNormalizer|null $normalizer
2828
*/
29-
public function __construct( StringNormalizer $normalizer = null ) {
29+
public function __construct( ?StringNormalizer $normalizer = null ) {
3030
$this->normalizer = $normalizer ?: new NullStringNormalizer();
3131
}
3232

src/ValueParsers/StringValueParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class StringValueParser implements ValueParser {
2828
/**
2929
* @param ParserOptions|null $options
3030
*/
31-
public function __construct( ParserOptions $options = null ) {
31+
public function __construct( ?ParserOptions $options = null ) {
3232
$this->options = $options ?: new ParserOptions();
3333

3434
$this->defaultOption( ValueParser::OPT_LANG, 'en' );

tests/ValueParsers/DispatchingValueParserTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
*/
2323
class DispatchingValueParserTest extends TestCase {
2424

25-
private function getParser( $invocation ) : ValueParser {
25+
private function getParser( $invocation ): ValueParser {
2626
$mock = $this->createMock( ValueParser::class );
2727

2828
$mock->expects( $invocation )
2929
->method( 'parse' )
30-
->will( $this->returnCallback( function( $value ) {
30+
->willReturnCallback( static function ( $value ) {
3131
if ( $value === 'invalid' ) {
3232
throw new ParseException( 'failed' );
3333
}
3434
return $value;
35-
} ) );
35+
} );
3636

3737
return $mock;
3838
}

tests/ValueParsers/NullParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function invalidInputProvider() {
5555
*
5656
* @dataProvider invalidInputProvider
5757
*/
58-
public function testParseWithInvalidInputs( $value, ValueParser $parser = null ) {
58+
public function testParseWithInvalidInputs( $value, ?ValueParser $parser = null ) {
5959
$this->markTestSkipped( 'NullParser has no invalid inputs' );
6060
}
6161

0 commit comments

Comments
 (0)