From 47186970ad2679cade3217ede0df37cbd22773d6 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 12 May 2023 18:19:39 +0200 Subject: [PATCH 1/2] Deps updated --- composer.json | 2 +- src/Decoder.php | 2 +- src/IndefiniteLengthByteStringObject.php | 9 +++++++-- src/IndefiniteLengthListObject.php | 9 +++++++-- src/IndefiniteLengthTextStringObject.php | 9 +++++++-- src/OtherObject/SimpleObject.php | 2 +- src/Tag/TimestampTag.php | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 7a9d7e2..bc7e020 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.15", + "rector/rector": "^0.16", "roave/security-advisories": "dev-latest", "symfony/var-dumper": "^6.0", "symplify/easy-coding-standard": "^11.0" diff --git a/src/Decoder.php b/src/Decoder.php index 2cc92c6..2b5b7d5 100644 --- a/src/Decoder.php +++ b/src/Decoder.php @@ -234,6 +234,6 @@ private function generateOtherObjectManager(): OtherObjectManagerInterface ->add(HalfPrecisionFloatObject::class) ->add(SinglePrecisionFloatObject::class) ->add(DoublePrecisionFloatObject::class) - ; + ; } } diff --git a/src/IndefiniteLengthByteStringObject.php b/src/IndefiniteLengthByteStringObject.php index 38b2ed2..6992ffd 100644 --- a/src/IndefiniteLengthByteStringObject.php +++ b/src/IndefiniteLengthByteStringObject.php @@ -30,9 +30,14 @@ public function __toString(): string return $result . "\xFF"; } - public static function create(): self + public static function create(string ...$chunks): self { - return new self(); + $object = new self(); + foreach ($chunks as $chunk) { + $object->append($chunk); + } + + return $object; } public function add(ByteStringObject $chunk): self diff --git a/src/IndefiniteLengthListObject.php b/src/IndefiniteLengthListObject.php index 1aef00d..00e9261 100644 --- a/src/IndefiniteLengthListObject.php +++ b/src/IndefiniteLengthListObject.php @@ -42,9 +42,14 @@ public function __toString(): string return $result . "\xFF"; } - public static function create(): self + public static function create(CBORObject ...$items): self { - return new self(); + $object = new self(); + foreach ($items as $item) { + $object->add($item); + } + + return $object; } /** diff --git a/src/IndefiniteLengthTextStringObject.php b/src/IndefiniteLengthTextStringObject.php index 3ef2d22..2dfbe04 100644 --- a/src/IndefiniteLengthTextStringObject.php +++ b/src/IndefiniteLengthTextStringObject.php @@ -30,9 +30,14 @@ public function __toString(): string return $result . "\xFF"; } - public static function create(): self + public static function create(string ...$chunks): self { - return new self(); + $object = new self(); + foreach ($chunks as $chunk) { + $object->append($chunk); + } + + return $object; } public function add(TextStringObject $chunk): self diff --git a/src/OtherObject/SimpleObject.php b/src/OtherObject/SimpleObject.php index a47379c..7a102d4 100644 --- a/src/OtherObject/SimpleObject.php +++ b/src/OtherObject/SimpleObject.php @@ -14,7 +14,7 @@ final class SimpleObject extends Base implements Normalizable { public static function supportedAdditionalInformation(): array { - return array_merge(range(0, 19), [24]); + return [...range(0, 19), 24]; } public static function createFromLoadedData(int $additionalInformation, ?string $data): Base diff --git a/src/Tag/TimestampTag.php b/src/Tag/TimestampTag.php index c9a725c..afdec9f 100644 --- a/src/Tag/TimestampTag.php +++ b/src/Tag/TimestampTag.php @@ -53,7 +53,7 @@ public function normalize(): DateTimeInterface case $object instanceof NegativeIntegerObject: $formatted = DateTimeImmutable::createFromFormat('U', $object->normalize()); - break; + break; case $object instanceof HalfPrecisionFloatObject: case $object instanceof SinglePrecisionFloatObject: case $object instanceof DoublePrecisionFloatObject: From a5152382cfa3867ff36386589c1fcf6792e39ce7 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Fri, 12 May 2023 18:30:11 +0200 Subject: [PATCH 2/2] PHPUNIT fixed --- composer.json | 2 +- phpunit.xml.dist | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 6489e8a..9fe3293 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^10.1", "rector/rector": "^0.16", "roave/security-advisories": "dev-latest", "symfony/var-dumper": "^6.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0769eb4..19e0434 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,13 +2,9 @@ - - - ./src - - + ./tests/ @@ -20,4 +16,9 @@ + + + ./src + +