Skip to content

Commit 5bd70aa

Browse files
committed
deps: allow brick/math 0.12
deps: other dev deps update
1 parent 81d5dff commit 5bd70aa

32 files changed

+603
-539
lines changed

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@
2525
},
2626
"require": {
2727
"php": ">=8.0",
28-
"brick/math": "^0.9|^0.10|^0.11",
28+
"brick/math": "^0.9|^0.10|^0.11|^0.12",
2929
"ext-mbstring": "*"
3030
},
3131
"require-dev": {
3232
"ext-json": "*",
3333
"ekino/phpstan-banned-code": "^1.0",
34-
"infection/infection": "^0.26",
34+
"infection/infection": "^0.27",
3535
"phpstan/extension-installer": "^1.1",
3636
"phpstan/phpstan": "^1.0",
3737
"phpstan/phpstan-beberlei-assert": "^1.0",
3838
"phpstan/phpstan-deprecation-rules": "^1.0",
3939
"phpstan/phpstan-phpunit": "^1.0",
4040
"phpstan/phpstan-strict-rules": "^1.0",
4141
"phpunit/phpunit": "^10.0",
42-
"rector/rector": "^0.15",
42+
"rector/rector": "^0.19",
4343
"roave/security-advisories": "dev-latest",
44-
"symfony/var-dumper": "^6.0",
45-
"symplify/easy-coding-standard": "^11.1",
44+
"symfony/var-dumper": "^6.0|^7.0",
45+
"symplify/easy-coding-standard": "^12.0",
4646
"php-parallel-lint/php-parallel-lint": "^1.3",
4747
"qossmic/deptrac-shim": "^1.0"
4848
},

ecs.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
$config->import(SetList::NAMESPACES);
4848
$config->import(SetList::STRICT);
4949

50-
$services = $config->services();
5150
$config->rule(StrictParamFixer::class);
5251
$config->rule(StrictComparisonFixer::class);
5352
$config->rule(ArrayIndentationFixer::class);
@@ -89,9 +88,9 @@
8988
'import_functions' => true,
9089
]);
9190

92-
$config->services()
93-
->remove(PhpUnitTestClassRequiresCoversFixer::class);
9491
$config->parallel();
9592
$config->paths([__DIR__]);
96-
$config->skip([__DIR__ . '/.github', __DIR__ . '/build', __DIR__ . '/vendor']);
93+
$config->skip(
94+
[__DIR__ . '/.github', __DIR__ . '/build', __DIR__ . '/vendor', PhpUnitTestClassRequiresCoversFixer::class]
95+
);
9796
};

rector.php

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Core\ValueObject\PhpVersion;
6+
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
77
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
88
use Rector\PHPUnit\Set\PHPUnitSetList;
99
use Rector\Set\ValueObject\LevelSetList;
1010
use Rector\Set\ValueObject\SetList;
1111
use Rector\Symfony\Set\SymfonySetList;
12+
use Rector\ValueObject\PhpVersion;
1213

1314
return static function (RectorConfig $config): void {
1415
$config->import(SetList::DEAD_CODE);
1516
$config->import(LevelSetList::UP_TO_PHP_80);
1617
$config->import(SymfonySetList::SYMFONY_CODE_QUALITY);
1718
$config->import(PHPUnitLevelSetList::UP_TO_PHPUNIT_100);
1819
$config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
19-
$config->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
20-
$config->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
21-
$config->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
2220
$config->parallel();
2321
$config->paths([__DIR__ . '/src', __DIR__ . '/tests']);
24-
$config->skip([__DIR__ . '/src/IndefiniteLengthMapObject.php', __DIR__ . '/src/MapObject.php']);
22+
$config->skip(
23+
[
24+
__DIR__ . '/src/IndefiniteLengthMapObject.php',
25+
__DIR__ . '/src/MapObject.php',
26+
PreferPHPUnitThisCallRector::class,
27+
]
28+
);
2529
$config->phpVersion(PhpVersion::PHP_80);
2630
$config->importNames();
2731
$config->importShortClasses();

src/AbstractCBORObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace CBOR;
66

7-
use function chr;
87
use Stringable;
8+
use function chr;
99

1010
abstract class AbstractCBORObject implements CBORObject, Stringable
1111
{

src/Decoder.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
use CBOR\Tag\UnsignedBigIntegerTag;
3434
use CBOR\Tag\UriTag;
3535
use InvalidArgumentException;
36-
use function ord;
3736
use RuntimeException;
37+
use function ord;
3838
use const STR_PAD_LEFT;
3939

4040
final class Decoder implements DecoderInterface
@@ -150,7 +150,7 @@ private function processInfinite(Stream $stream, int $mt, bool $breakable): CBOR
150150
}
151151

152152
return $object;
153-
case CBORObject::MAJOR_TYPE_TEXT_STRING: //3
153+
case CBORObject::MAJOR_TYPE_TEXT_STRING : //3
154154
$object = IndefiniteLengthTextStringObject::create();
155155
while (! ($it = $this->process($stream, true)) instanceof BreakObject) {
156156
if (! $it instanceof TextStringObject) {
@@ -162,7 +162,7 @@ private function processInfinite(Stream $stream, int $mt, bool $breakable): CBOR
162162
}
163163

164164
return $object;
165-
case CBORObject::MAJOR_TYPE_LIST: //4
165+
case CBORObject::MAJOR_TYPE_LIST : //4
166166
$object = IndefiniteLengthListObject::create();
167167
$it = $this->process($stream, true);
168168
while (! $it instanceof BreakObject) {
@@ -171,23 +171,23 @@ private function processInfinite(Stream $stream, int $mt, bool $breakable): CBOR
171171
}
172172

173173
return $object;
174-
case CBORObject::MAJOR_TYPE_MAP: //5
174+
case CBORObject::MAJOR_TYPE_MAP : //5
175175
$object = IndefiniteLengthMapObject::create();
176176
while (! ($it = $this->process($stream, true)) instanceof BreakObject) {
177177
$object->add($it, $this->process($stream, false));
178178
}
179179

180180
return $object;
181-
case CBORObject::MAJOR_TYPE_OTHER_TYPE: //7
181+
case CBORObject::MAJOR_TYPE_OTHER_TYPE : //7
182182
if (! $breakable) {
183183
throw new InvalidArgumentException('Cannot parse the data. No enclosing indefinite.');
184184
}
185185

186186
return BreakObject::create();
187-
case CBORObject::MAJOR_TYPE_UNSIGNED_INTEGER: //0
188-
case CBORObject::MAJOR_TYPE_NEGATIVE_INTEGER: //1
189-
case CBORObject::MAJOR_TYPE_TAG: //6
190-
default:
187+
case CBORObject::MAJOR_TYPE_UNSIGNED_INTEGER : //0
188+
case CBORObject::MAJOR_TYPE_NEGATIVE_INTEGER : //1
189+
case CBORObject::MAJOR_TYPE_TAG : //6
190+
default :
191191
throw new InvalidArgumentException(sprintf(
192192
'Cannot parse the data. Found infinite length for Major Type "%s" (%d).',
193193
str_pad(decbin($mt), 5, '0', STR_PAD_LEFT),

src/IndefiniteLengthListObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace CBOR;
66

7-
use function array_key_exists;
87
use ArrayAccess;
98
use ArrayIterator;
109
use InvalidArgumentException;
1110
use Iterator;
1211
use IteratorAggregate;
12+
use function array_key_exists;
1313

1414
/**
1515
* @phpstan-implements ArrayAccess<int, CBORObject>

src/IndefiniteLengthMapObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace CBOR;
66

7-
use function array_key_exists;
87
use ArrayAccess;
98
use ArrayIterator;
109
use InvalidArgumentException;
1110
use Iterator;
1211
use IteratorAggregate;
12+
use function array_key_exists;
1313

1414
/**
1515
* @phpstan-implements ArrayAccess<int, CBORObject>

src/LengthCalculator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace CBOR;
66

77
use Brick\Math\BigInteger;
8+
use InvalidArgumentException;
89
use function chr;
910
use function count;
10-
use InvalidArgumentException;
1111
use const STR_PAD_LEFT;
1212

1313
final class LengthCalculator

src/ListObject.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace CBOR;
66

7-
use function array_key_exists;
87
use ArrayAccess;
98
use ArrayIterator;
10-
use function count;
119
use Countable;
1210
use InvalidArgumentException;
1311
use Iterator;
1412
use IteratorAggregate;
13+
use function array_key_exists;
14+
use function count;
1515

1616
/**
1717
* @phpstan-implements ArrayAccess<int, CBORObject>
@@ -36,9 +36,6 @@ public function __construct(array $data = [])
3636
{
3737
[$additionalInformation, $length] = LengthCalculator::getLengthOfArray($data);
3838
array_map(static function ($item): void {
39-
if (! $item instanceof CBORObject) {
40-
throw new InvalidArgumentException('The list must contain only CBORObject objects.');
41-
}
4239
}, $data);
4340

4441
parent::__construct(self::MAJOR_TYPE, $additionalInformation);

src/MapObject.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
namespace CBOR;
66

7-
use function array_key_exists;
87
use ArrayAccess;
98
use ArrayIterator;
10-
use function count;
119
use Countable;
1210
use InvalidArgumentException;
1311
use Iterator;
1412
use IteratorAggregate;
13+
use function array_key_exists;
14+
use function count;
1515

1616
/**
1717
* @phpstan-implements ArrayAccess<int, CBORObject>

src/OtherObject/DoublePrecisionFloatObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use CBOR\Normalizable;
99
use CBOR\OtherObject as Base;
1010
use CBOR\Utils;
11-
use const INF;
1211
use InvalidArgumentException;
12+
use const INF;
1313
use const NAN;
1414

1515
final class DoublePrecisionFloatObject extends Base implements Normalizable

src/OtherObject/HalfPrecisionFloatObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use CBOR\Normalizable;
99
use CBOR\OtherObject as Base;
1010
use CBOR\Utils;
11-
use const INF;
1211
use InvalidArgumentException;
12+
use const INF;
1313
use const NAN;
1414

1515
final class HalfPrecisionFloatObject extends Base implements Normalizable

src/OtherObject/OtherObjectManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace CBOR\OtherObject;
66

7-
use function array_key_exists;
87
use CBOR\OtherObject;
98
use InvalidArgumentException;
9+
use function array_key_exists;
1010

1111
class OtherObjectManager implements OtherObjectManagerInterface
1212
{

src/OtherObject/SimpleObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use CBOR\Normalizable;
88
use CBOR\OtherObject as Base;
99
use CBOR\Utils;
10-
use function chr;
1110
use InvalidArgumentException;
11+
use function chr;
1212
use function ord;
1313

1414
final class SimpleObject extends Base implements Normalizable

src/OtherObject/SinglePrecisionFloatObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use Brick\Math\BigInteger;
88
use CBOR\OtherObject as Base;
99
use CBOR\Utils;
10-
use const INF;
1110
use InvalidArgumentException;
11+
use const INF;
1212
use const NAN;
1313

1414
final class SinglePrecisionFloatObject extends Base

src/Tag/BigFloatTag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
use CBOR\Normalizable;
1111
use CBOR\Tag;
1212
use CBOR\UnsignedIntegerObject;
13-
use function count;
14-
use function extension_loaded;
1513
use InvalidArgumentException;
1614
use RuntimeException;
15+
use function count;
16+
use function extension_loaded;
1717

1818
final class BigFloatTag extends Tag implements Normalizable
1919
{

src/Tag/DatetimeTag.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
use CBOR\Normalizable;
1010
use CBOR\Tag;
1111
use CBOR\TextStringObject;
12-
use const DATE_RFC3339;
1312
use DateTimeImmutable;
1413
use DateTimeInterface;
1514
use InvalidArgumentException;
15+
use const DATE_RFC3339;
1616

1717
/**
1818
* @see \CBOR\Test\Tag\DatetimeTagTest

src/Tag/DecimalFractionTag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
use CBOR\Normalizable;
1111
use CBOR\Tag;
1212
use CBOR\UnsignedIntegerObject;
13-
use function count;
14-
use function extension_loaded;
1513
use InvalidArgumentException;
1614
use RuntimeException;
15+
use function count;
16+
use function extension_loaded;
1717

1818
final class DecimalFractionTag extends Tag implements Normalizable
1919
{

src/Tag/TagManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace CBOR\Tag;
66

7-
use function array_key_exists;
87
use CBOR\CBORObject;
98
use CBOR\Tag;
109
use CBOR\Utils;
1110
use InvalidArgumentException;
11+
use function array_key_exists;
1212

1313
final class TagManager implements TagManagerInterface
1414
{

tests/ByteStringObjectTest.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CBOR\ByteStringObject;
88
use CBOR\CBORObject;
99
use CBOR\StringStream;
10+
use Iterator;
1011
use PHPUnit\Framework\Attributes\DataProvider;
1112
use PHPUnit\Framework\Attributes\Test;
1213

@@ -47,12 +48,10 @@ public function aByteStringObjectCanBeCreated(
4748
static::assertSame($string, $decoded->normalize());
4849
}
4950

50-
public static function getData(): array
51+
public static function getData(): Iterator
5152
{
52-
return [
53-
['Hello', 5, 5, '4548656c6c6f'],
54-
['(。◕‿◕。)', 17, 17, '5128efbda1e29795e280bfe29795efbda129'],
55-
['HelloHelloHelloHelloHello', 24, 25, '581948656c6c6f48656c6c6f48656c6c6f48656c6c6f48656c6c6f'],
56-
];
53+
yield ['Hello', 5, 5, '4548656c6c6f'];
54+
yield ['(。◕‿◕。)', 17, 17, '5128efbda1e29795e280bfe29795efbda129'];
55+
yield ['HelloHelloHelloHelloHello', 24, 25, '581948656c6c6f48656c6c6f48656c6c6f48656c6c6f48656c6c6f'];
5756
}
5857
}

0 commit comments

Comments
 (0)