Skip to content

Commit 046855d

Browse files
committed
feat: Require PHP >= 8.2
1 parent f483081 commit 046855d

38 files changed

Lines changed: 97 additions & 123 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: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,35 @@
33
namespace MessagePack;
44

55
use PhpCsFixer\Config;
6+
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
67
use PhpCsFixer\Fixer\ConstantNotation\NativeConstantInvocationFixer;
7-
use PhpCsFixer\Fixer\FixerInterface;
88
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
9+
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
10+
use PhpCsFixer\FixerDefinition\FixerDefinition;
11+
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
912
use PhpCsFixer\Tokenizer\Tokens;
1013

11-
final class FilterableFixer implements FixerInterface
14+
final class FilterableFixer implements ConfigurableFixerInterface
1215
{
13-
private $fixer;
14-
private $pathRegex;
16+
private ConfigurableFixerInterface $fixer;
17+
private string $pathRegex;
1518

16-
public function __construct(FixerInterface $fixer, string $pathRegex)
19+
public function __construct(ConfigurableFixerInterface $fixer, string $pathRegex)
1720
{
1821
$this->fixer = $fixer;
1922
$this->pathRegex = $pathRegex;
2023
}
2124

25+
public function configure(array $configuration): void
26+
{
27+
$this->fixer->configure($configuration);
28+
}
29+
30+
public function getConfigurationDefinition(): FixerConfigurationResolver
31+
{
32+
return $this->fixer->getConfigurationDefinition();
33+
}
34+
2235
public function isCandidate(Tokens $tokens) : bool
2336
{
2437
return $this->fixer->isCandidate($tokens);
@@ -52,7 +65,12 @@ public function supports(\SplFileInfo $file) : bool
5265

5366
return $this->fixer->supports($file);
5467
}
55-
};
68+
69+
public function getDefinition() : FixerDefinitionInterface
70+
{
71+
return $this->fixer->getDefinition();
72+
}
73+
}
5674

5775
$header = <<<EOF
5876
This file is part of the rybakit/msgpack.php package.
@@ -63,7 +81,7 @@ public function supports(\SplFileInfo $file) : bool
6381
file that was distributed with this source code.
6482
EOF;
6583

66-
return Config::create()
84+
return (new Config())
6785
->setUsingCache(false)
6886
->setRiskyAllowed(true)
6987
->registerCustomFixers([
@@ -75,13 +93,16 @@ public function supports(\SplFileInfo $file) : bool
7593
'@Symfony:risky' => true,
7694
'array_syntax' => ['syntax' => 'short'],
7795
'binary_operator_spaces' => ['operators' => ['=' => null, '=>' => null]],
78-
'is_null' => false, // https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4015
96+
'fully_qualified_strict_types' => false,
97+
'integer_literal_case' => false,
98+
'is_null' => false,
7999
'native_constant_invocation' => false,
80100
'native_function_invocation' => false,
81-
'FilterableFixer/native_constant_invocation' => true,
82-
'FilterableFixer/native_function_invocation' => true,
101+
'FilterableFixer/native_constant_invocation' => ['strict' => false],
102+
'FilterableFixer/native_function_invocation' => ['strict' => false],
83103
'no_useless_else' => true,
84104
'no_useless_return' => true,
105+
'no_useless_concat_operator' => false,
85106
'ordered_imports' => [
86107
'sort_algorithm' => 'alpha',
87108
'imports_order' => ['class', 'function', 'const'],
@@ -90,6 +111,7 @@ public function supports(\SplFileInfo $file) : bool
90111
'phpdoc_order' => true,
91112
'phpdoc_to_comment' => false,
92113
'return_type_declaration' => ['space_before' => 'one'],
114+
'statement_indentation' => false,
93115
'strict_comparison' => true,
94116
'header_comment' => [
95117
'comment_type' => 'PHPDoc',

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",

examples/MessagePack/DateTimeExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public function __construct(int $type)
2424
$this->type = $type;
2525
}
2626

27+
#[\Override]
2728
public function getType() : int
2829
{
2930
return $this->type;
3031
}
3132

33+
#[\Override]
3234
public function pack(Packer $packer, $value) : ?string
3335
{
3436
if (!$value instanceof \DateTimeInterface) {
@@ -38,6 +40,7 @@ public function pack(Packer $packer, $value) : ?string
3840
return $packer->packExt($this->type, $value->format('YmdHisue'));
3941
}
4042

43+
#[\Override]
4144
public function unpackExt(BufferUnpacker $unpacker, int $extLength)
4245
{
4346
return \DateTimeImmutable::createFromFormat('YmdHisue', $unpacker->read($extLength));

examples/MessagePack/StructListExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public function __construct(int $type)
2424
$this->type = $type;
2525
}
2626

27+
#[\Override]
2728
public function getType() : int
2829
{
2930
return $this->type;
3031
}
3132

33+
#[\Override]
3234
public function pack(Packer $packer, $value) : ?string
3335
{
3436
if (!$value instanceof StructList) {
@@ -56,6 +58,7 @@ public function pack(Packer $packer, $value) : ?string
5658
);
5759
}
5860

61+
#[\Override]
5962
public function unpackExt(BufferUnpacker $unpacker, int $extLength)
6063
{
6164
$keys = $unpacker->unpackArray();

examples/MessagePack/TextExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ public function __construct(int $type, int $minLength = 100)
2626
$this->minLength = $minLength;
2727
}
2828

29+
#[\Override]
2930
public function getType() : int
3031
{
3132
return $this->type;
3233
}
3334

35+
#[\Override]
3436
public function pack(Packer $packer, $value) : ?string
3537
{
3638
if (!$value instanceof Text) {
@@ -50,6 +52,7 @@ public function pack(Packer $packer, $value) : ?string
5052
: $packer->packExt($this->type, $compressed);
5153
}
5254

55+
#[\Override]
5356
public function unpackExt(BufferUnpacker $unpacker, int $extLength)
5457
{
5558
$compressed = $unpacker->read($extLength);

examples/MessagePack/TraversableExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public function __construct(int $type)
2424
$this->type = $type;
2525
}
2626

27+
#[\Override]
2728
public function getType() : int
2829
{
2930
return $this->type;
3031
}
3132

33+
#[\Override]
3234
public function pack(Packer $packer, $value) : ?string
3335
{
3436
if (!$value instanceof \Traversable) {
@@ -47,6 +49,7 @@ public function pack(Packer $packer, $value) : ?string
4749
);
4850
}
4951

52+
#[\Override]
5053
public function unpackExt(BufferUnpacker $unpacker, int $extLength)
5154
{
5255
$size = $unpacker->unpackArrayHeader();

examples/MessagePack/Uint64.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function __toString() : string
2929
return $this->value;
3030
}
3131

32+
#[\Override]
3233
public function pack(Packer $packer) : string
3334
{
3435
return "\xcf".\gmp_export($this->value);

0 commit comments

Comments
 (0)