Skip to content

Commit 697769f

Browse files
committed
feat: Require PHP >= 8.2
1 parent f483081 commit 697769f

14 files changed

Lines changed: 40 additions & 78 deletions

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ examples export-ignore
33
tests export-ignore
44
.gitattributes export-ignore
55
.gitignore export-ignore
6-
.php_cs.dist export-ignore
6+
.php-cs-fixer.dist.php export-ignore
77
dockerfile.sh export-ignore
88
phpunit.xml.dist export-ignore
99
psalm.xml export-ignore

.github/workflows/qa.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,10 @@ jobs:
1111
matrix:
1212
operating-system: [ubuntu-latest]
1313
env:
14-
- PHP_IMAGE: php:7.3-cli
15-
16-
- PHP_IMAGE: php:7.4-cli
17-
COVERAGE_FILE: coverage.clover
18-
19-
- PHP_IMAGE: php:8.0-cli
20-
QA: 1
21-
22-
- PHP_IMAGE: php:8.1-cli
2314
- PHP_IMAGE: php:8.2-cli
15+
COVERAGE_FILE: coverage.clover
2416
- PHP_IMAGE: php:8.3-cli
17+
QA: 1
2518
- PHP_IMAGE: php:8.4-cli
2619
- PHP_IMAGE: php:8.5-cli
2720

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
namespace MessagePack;
44

55
use PhpCsFixer\Config;
6-
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
76
use PhpCsFixer\Fixer\FixerInterface;
7+
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
88
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
9+
use PhpCsFixer\FixerDefinition\FixerDefinition;
10+
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
911
use PhpCsFixer\Tokenizer\Tokens;
1012

1113
final class FilterableFixer implements FixerInterface
1214
{
13-
private $fixer;
14-
private $pathRegex;
15+
private FixerInterface $fixer;
16+
private string $pathRegex;
1517

1618
public function __construct(FixerInterface $fixer, string $pathRegex)
1719
{
@@ -52,7 +54,12 @@ public function supports(\SplFileInfo $file) : bool
5254

5355
return $this->fixer->supports($file);
5456
}
55-
};
57+
58+
public function getDefinition() : FixerDefinitionInterface
59+
{
60+
return $this->fixer->getDefinition();
61+
}
62+
}
5663

5764
$header = <<<EOF
5865
This file is part of the rybakit/msgpack.php package.
@@ -63,7 +70,7 @@ public function supports(\SplFileInfo $file) : bool
6370
file that was distributed with this source code.
6471
EOF;
6572

66-
return Config::create()
73+
return (new Config())
6774
->setUsingCache(false)
6875
->setRiskyAllowed(true)
6976
->registerCustomFixers([
@@ -75,7 +82,7 @@ public function supports(\SplFileInfo $file) : bool
7582
'@Symfony:risky' => true,
7683
'array_syntax' => ['syntax' => 'short'],
7784
'binary_operator_spaces' => ['operators' => ['=' => null, '=>' => null]],
78-
'is_null' => false, // https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4015
85+
'is_null' => false,
7986
'native_constant_invocation' => false,
8087
'native_function_invocation' => false,
8188
'FilterableFixer/native_constant_invocation' => true,

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2025 Eugene Leonovich
3+
Copyright (c) 2015-2026 Eugene Leonovich
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.1.1|^8"
14+
"php": "^8.2"
1515
},
1616
"require-dev": {
1717
"ext-gmp": "*",
18-
"friendsofphp/php-cs-fixer": "^2.14",
19-
"phpunit/phpunit": "^7.1|^8|^9",
20-
"vimeo/psalm": "^3.9|^4"
18+
"friendsofphp/php-cs-fixer": "^3",
19+
"phpunit/phpunit": "^11",
20+
"vimeo/psalm": "^5 || ^6"
2121
},
2222
"suggest": {
2323
"ext-decimal": "For converting overflowed integers to Decimal objects",

phpunit.xml.dist

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
75
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
116
processIsolation="false"
127
stopOnFailure="false"
13-
verbose="true"
148
bootstrap="vendor/autoload.php"
159
>
1610
<php>
@@ -29,9 +23,9 @@
2923
</testsuite>
3024
</testsuites>
3125

32-
<filter>
33-
<whitelist>
26+
<source>
27+
<include>
3428
<directory>src</directory>
35-
</whitelist>
36-
</filter>
29+
</include>
30+
</source>
3731
</phpunit>

src/BufferUnpacker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ private function unpackUint64()
604604
return $num;
605605
}
606606
if ($this->isBigIntAsDec) {
607-
return new Decimal(\sprintf('%u', $num));
607+
return Decimal::valueOf(\sprintf('%u', $num));
608608
}
609609
if ($this->isBigIntAsGmp) {
610610
return \gmp_import(\substr($this->buffer, $this->offset - 8, 8));

tests/ExamplesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testExample(string $filename) : void
2929
}
3030
}
3131

32-
public function provideExampleData() : iterable
32+
public static function provideExampleData() : iterable
3333
{
3434
$dir = dirname(__DIR__).'/examples';
3535
foreach (glob("$dir/*.php") as $filename) {

tests/Unit/BufferUnpackerTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
final class BufferUnpackerTest extends TestCase
2727
{
28-
use PhpUnitCompat;
29-
3028
/**
3129
* @var BufferUnpacker
3230
*/
@@ -70,7 +68,7 @@ public function testUnpackThrowsExceptionOnInsufficientData(string $data) : void
7068
self::fail(InsufficientDataException::class.' was not thrown');
7169
}
7270

73-
public function provideInsufficientData() : array
71+
public static function provideInsufficientData() : array
7472
{
7573
return [
7674
'str' => [''],
@@ -345,7 +343,7 @@ public function testConstructorSetsOptions($options) : void
345343
new BufferUnpacker('', $options);
346344
}
347345

348-
public function provideOptionsData() : iterable
346+
public static function provideOptionsData() : iterable
349347
{
350348
return [
351349
[0],
@@ -367,7 +365,7 @@ public function testConstructorThrowsExceptionOnInvalidOptions($options) : void
367365
new BufferUnpacker('', $options);
368366
}
369367

370-
public function provideInvalidOptionsData() : iterable
368+
public static function provideInvalidOptionsData() : iterable
371369
{
372370
return [
373371
[UnpackOptions::BIGINT_AS_STR | UnpackOptions::BIGINT_AS_GMP],
@@ -661,7 +659,7 @@ public function testUnpackThrowsExceptionOnInvalidMapKey(string $packedMap, stri
661659
$this->unpacker->unpack();
662660
}
663661

664-
public function provideMapWithInvalidKeyData() : iterable
662+
public static function provideMapWithInvalidKeyData() : iterable
665663
{
666664
$data = static function () {
667665
yield 'nil' => DataProvider::provideNilData();
@@ -745,7 +743,7 @@ public function testUnpackAllowsZeroLengthExtData(string $data) : void
745743
self::assertSame('', $ext->data);
746744
}
747745

748-
public function provideInvalidExtBodyData() : iterable
746+
public static function provideInvalidExtBodyData() : iterable
749747
{
750748
return [
751749
'ext8' => ["\xc7\x00\x01"],

tests/Unit/Exception/InvalidOptionExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testOutOfRange(string $invalidOption, array $validOptions, strin
2626
self::assertSame($message, $exception->getMessage());
2727
}
2828

29-
public function provideOutOfRangeData() : array
29+
public static function provideOutOfRangeData() : array
3030
{
3131
return [
3232
['foobar', ['foo'], 'Invalid option foobar, use foo'],

0 commit comments

Comments
 (0)