diff --git a/composer.json b/composer.json index 473a148..9fe3293 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,8 @@ "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^10.0", - "rector/rector": "^0.15", + "phpunit/phpunit": "^10.1", + "rector/rector": "^0.16", "roave/security-advisories": "dev-latest", "symfony/var-dumper": "^6.0", "symplify/easy-coding-standard": "^11.1", 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 + + diff --git a/src/IndefiniteLengthByteStringObject.php b/src/IndefiniteLengthByteStringObject.php index ebe97c1..0373a70 100644 --- a/src/IndefiniteLengthByteStringObject.php +++ b/src/IndefiniteLengthByteStringObject.php @@ -33,9 +33,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 bc3a15d..ccb6d78 100644 --- a/src/IndefiniteLengthTextStringObject.php +++ b/src/IndefiniteLengthTextStringObject.php @@ -33,9 +33,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 03b6d05..a351ea2 100644 --- a/src/OtherObject/SimpleObject.php +++ b/src/OtherObject/SimpleObject.php @@ -15,7 +15,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 create(int $value): self|FalseObject|TrueObject|NullObject|UndefinedObject