diff --git a/src/IndefiniteLengthByteStringObject.php b/src/IndefiniteLengthByteStringObject.php index bc6e7a7..ebe97c1 100644 --- a/src/IndefiniteLengthByteStringObject.php +++ b/src/IndefiniteLengthByteStringObject.php @@ -4,6 +4,9 @@ namespace CBOR; +/** + * @see \CBOR\Test\IndefiniteLengthByteStringObjectTest + */ final class IndefiniteLengthByteStringObject extends AbstractCBORObject implements Normalizable { private const MAJOR_TYPE = self::MAJOR_TYPE_BYTE_STRING; @@ -11,8 +14,8 @@ final class IndefiniteLengthByteStringObject extends AbstractCBORObject implemen private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE; /** - * @var ByteStringObject[] - */ + * @var ByteStringObject[] + */ private array $chunks = []; public function __construct() diff --git a/src/IndefiniteLengthListObject.php b/src/IndefiniteLengthListObject.php index 0a55341..e1bef93 100644 --- a/src/IndefiniteLengthListObject.php +++ b/src/IndefiniteLengthListObject.php @@ -23,8 +23,8 @@ class IndefiniteLengthListObject extends AbstractCBORObject implements IteratorA private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE; /** - * @var CBORObject[] - */ + * @var CBORObject[] + */ private array $data = []; public function __construct() @@ -48,8 +48,8 @@ public static function create(): self } /** - * @return mixed[] - */ + * @return mixed[] + */ public function normalize(): array { return array_map( @@ -102,8 +102,8 @@ public function set(int $index, CBORObject $object): self } /** - * @return Iterator - */ + * @return Iterator + */ public function getIterator(): Iterator { return new ArrayIterator($this->data); diff --git a/src/IndefiniteLengthMapObject.php b/src/IndefiniteLengthMapObject.php index 3a5ae22..ece69f2 100644 --- a/src/IndefiniteLengthMapObject.php +++ b/src/IndefiniteLengthMapObject.php @@ -23,8 +23,8 @@ class IndefiniteLengthMapObject extends AbstractCBORObject implements IteratorAg private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE; /** - * @var MapItem[] - */ + * @var MapItem[] + */ private array $data = []; public function __construct() @@ -96,16 +96,16 @@ public function set(MapItem $object): self } /** - * @return Iterator - */ + * @return Iterator + */ public function getIterator(): Iterator { return new ArrayIterator($this->data); } /** - * @return mixed[] - */ + * @return mixed[] + */ public function normalize(): array { return array_reduce($this->data, static function (array $carry, MapItem $item): array { diff --git a/src/IndefiniteLengthTextStringObject.php b/src/IndefiniteLengthTextStringObject.php index b6af8d0..bc3a15d 100644 --- a/src/IndefiniteLengthTextStringObject.php +++ b/src/IndefiniteLengthTextStringObject.php @@ -4,6 +4,9 @@ namespace CBOR; +/** + * @see \CBOR\Test\IndefiniteLengthTextStringObjectTest + */ final class IndefiniteLengthTextStringObject extends AbstractCBORObject implements Normalizable { private const MAJOR_TYPE = self::MAJOR_TYPE_TEXT_STRING; @@ -11,8 +14,8 @@ final class IndefiniteLengthTextStringObject extends AbstractCBORObject implemen private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE; /** - * @var TextStringObject[] - */ + * @var TextStringObject[] + */ private array $data = []; public function __construct() diff --git a/src/LengthCalculator.php b/src/LengthCalculator.php index d439b2b..ec8c678 100644 --- a/src/LengthCalculator.php +++ b/src/LengthCalculator.php @@ -13,8 +13,8 @@ final class LengthCalculator { /** - * @return array{int, null|string} - */ + * @return array{int, null|string} + */ public static function getLengthOfString(string $data): array { $length = mb_strlen($data, '8bit'); @@ -23,10 +23,10 @@ public static function getLengthOfString(string $data): array } /** - * @param array $data - * - * @return array{int, null|string} - */ + * @param array $data + * + * @return array{int, null|string} + */ public static function getLengthOfArray(array $data): array { $length = count($data); @@ -35,8 +35,8 @@ public static function getLengthOfArray(array $data): array } /** - * @return array{int, null|string} - */ + * @return array{int, null|string} + */ private static function computeLength(int $length): array { return match (true) { diff --git a/src/ListObject.php b/src/ListObject.php index af97bbd..4f8da72 100644 --- a/src/ListObject.php +++ b/src/ListObject.php @@ -16,21 +16,22 @@ /** * @phpstan-implements ArrayAccess * @phpstan-implements IteratorAggregate + * @see \CBOR\Test\ListObjectTest */ class ListObject extends AbstractCBORObject implements Countable, IteratorAggregate, Normalizable, ArrayAccess { private const MAJOR_TYPE = self::MAJOR_TYPE_LIST; /** - * @var CBORObject[] - */ + * @var CBORObject[] + */ private array $data; private ?string $length = null; /** - * @param CBORObject[] $data - */ + * @param CBORObject[] $data + */ public function __construct(array $data = []) { [$additionalInformation, $length] = LengthCalculator::getLengthOfArray($data); @@ -56,8 +57,8 @@ public function __toString(): string } /** - * @param CBORObject[] $data - */ + * @param CBORObject[] $data + */ public static function create(array $data = []): self { return new self($data); @@ -110,8 +111,8 @@ public function set(int $index, CBORObject $object): self } /** - * @return array - */ + * @return array + */ public function normalize(): array { return array_map( @@ -126,8 +127,8 @@ public function count(): int } /** - * @return Iterator - */ + * @return Iterator + */ public function getIterator(): Iterator { return new ArrayIterator($this->data); diff --git a/src/MapObject.php b/src/MapObject.php index 7e60e4e..72a7431 100644 --- a/src/MapObject.php +++ b/src/MapObject.php @@ -22,15 +22,15 @@ final class MapObject extends AbstractCBORObject implements Countable, IteratorA private const MAJOR_TYPE = self::MAJOR_TYPE_MAP; /** - * @var MapItem[] - */ + * @var MapItem[] + */ private array $data; private ?string $length = null; /** - * @param MapItem[] $data - */ + * @param MapItem[] $data + */ public function __construct(array $data = []) { [$additionalInformation, $length] = LengthCalculator::getLengthOfArray($data); @@ -64,8 +64,8 @@ public function __toString(): string } /** - * @param MapItem[] $data - */ + * @param MapItem[] $data + */ public static function create(array $data = []): self { return new self($data); @@ -127,16 +127,16 @@ public function count(): int } /** - * @return Iterator - */ + * @return Iterator + */ public function getIterator(): Iterator { return new ArrayIterator($this->data); } /** - * @return array - */ + * @return array + */ public function normalize(): array { return array_reduce($this->data, static function (array $carry, MapItem $item): array { diff --git a/src/Normalizable.php b/src/Normalizable.php index 9db0d44..7ff12bf 100644 --- a/src/Normalizable.php +++ b/src/Normalizable.php @@ -7,7 +7,7 @@ interface Normalizable { /** - * @return mixed|null - */ + * @return mixed|null + */ public function normalize(); } diff --git a/src/OtherObject/OtherObjectInterface.php b/src/OtherObject/OtherObjectInterface.php index a116f32..08b69e9 100644 --- a/src/OtherObject/OtherObjectInterface.php +++ b/src/OtherObject/OtherObjectInterface.php @@ -9,8 +9,8 @@ interface OtherObjectInterface extends CBORObject { /** - * @return int[] - */ + * @return int[] + */ public static function supportedAdditionalInformation(): array; public static function createFromLoadedData(int $additionalInformation, ?string $data): self; diff --git a/src/OtherObject/OtherObjectManager.php b/src/OtherObject/OtherObjectManager.php index 0375ee9..e691c3d 100644 --- a/src/OtherObject/OtherObjectManager.php +++ b/src/OtherObject/OtherObjectManager.php @@ -11,8 +11,8 @@ class OtherObjectManager implements OtherObjectManagerInterface { /** - * @var string[] - */ + * @var string[] + */ private array $classes = []; public static function create(): self diff --git a/src/StringStream.php b/src/StringStream.php index 9aa3c5d..d522813 100644 --- a/src/StringStream.php +++ b/src/StringStream.php @@ -10,8 +10,8 @@ final class StringStream implements Stream { /** - * @var resource - */ + * @var resource + */ private $resource; public function __construct(string $data) diff --git a/src/Tag.php b/src/Tag.php index f340ea6..556c85d 100644 --- a/src/Tag.php +++ b/src/Tag.php @@ -40,8 +40,8 @@ public function getValue(): CBORObject } /** - * @return array{int, null|string} - */ + * @return array{int, null|string} + */ protected static function determineComponents(int $tag): array { switch (true) { diff --git a/src/Tag/CBORTag.php b/src/Tag/CBORTag.php index 37d467e..631ec7a 100644 --- a/src/Tag/CBORTag.php +++ b/src/Tag/CBORTag.php @@ -28,8 +28,8 @@ public static function create(CBORObject $object): Tag } /** - * @return mixed|CBORObject|null - */ + * @return mixed|CBORObject|null + */ public function normalize() { return $this->object instanceof Normalizable ? $this->object->normalize() : $this->object; diff --git a/src/Tag/TagManager.php b/src/Tag/TagManager.php index 74b718c..0d3eb6d 100644 --- a/src/Tag/TagManager.php +++ b/src/Tag/TagManager.php @@ -13,8 +13,8 @@ final class TagManager implements TagManagerInterface { /** - * @var string[] - */ + * @var string[] + */ private array $classes = []; public static function create(): self diff --git a/src/Utils.php b/src/Utils.php index f2e0550..b75343f 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -49,8 +49,8 @@ public static function decode(string $data): string } /** - * @param mixed|null $data - */ + * @param mixed|null $data + */ public static function assertString($data, ?string $message = null): void { if (! is_string($data)) { diff --git a/tests/ByteStringObjectTest.php b/tests/ByteStringObjectTest.php index 04de8c0..fa924b5 100644 --- a/tests/ByteStringObjectTest.php +++ b/tests/ByteStringObjectTest.php @@ -13,7 +13,7 @@ /** * @internal -*/ + */ final class ByteStringObjectTest extends CBORTestCase { #[DataProvider('getData')] diff --git a/tests/CBORTestCase.php b/tests/CBORTestCase.php index 209b789..5574a28 100644 --- a/tests/CBORTestCase.php +++ b/tests/CBORTestCase.php @@ -9,7 +9,7 @@ /** * @internal -*/ + */ abstract class CBORTestCase extends TestCase { private ?Decoder $decoder = null; diff --git a/tests/DoublePrecisionFloat.php b/tests/DoublePrecisionFloat.php index 890a64d..3dcf68f 100644 --- a/tests/DoublePrecisionFloat.php +++ b/tests/DoublePrecisionFloat.php @@ -9,7 +9,7 @@ /** * @internal -*/ + */ final class DoublePrecisionFloat extends CBORTestCase { #[Test] diff --git a/tests/FloatTest.php b/tests/FloatTest.php index dee890b..fba3096 100644 --- a/tests/FloatTest.php +++ b/tests/FloatTest.php @@ -11,7 +11,7 @@ /** * @internal -*/ + */ final class FloatTest extends CBORTestCase { #[DataProvider('getDataSet')] diff --git a/tests/GlobalTest.php b/tests/GlobalTest.php index 2d84342..ec0c1ea 100644 --- a/tests/GlobalTest.php +++ b/tests/GlobalTest.php @@ -11,7 +11,7 @@ /** * @internal -*/ + */ final class GlobalTest extends CBORTestCase { #[DataProvider('getDataSet')] diff --git a/tests/IndefiniteLengthByteStringObjectTest.php b/tests/IndefiniteLengthByteStringObjectTest.php index a457af7..cd68757 100644 --- a/tests/IndefiniteLengthByteStringObjectTest.php +++ b/tests/IndefiniteLengthByteStringObjectTest.php @@ -13,7 +13,7 @@ /** * @internal -*/ + */ final class IndefiniteLengthByteStringObjectTest extends CBORTestCase { #[DataProvider('getData')] diff --git a/tests/IndefiniteLengthTextStringObjectTest.php b/tests/IndefiniteLengthTextStringObjectTest.php index fed1d80..8180ec7 100644 --- a/tests/IndefiniteLengthTextStringObjectTest.php +++ b/tests/IndefiniteLengthTextStringObjectTest.php @@ -14,7 +14,7 @@ /** * @internal -*/ + */ final class IndefiniteLengthTextStringObjectTest extends CBORTestCase { #[DataProvider('getData')] diff --git a/tests/InvalidTypeTest.php b/tests/InvalidTypeTest.php index 3c34a24..8042002 100644 --- a/tests/InvalidTypeTest.php +++ b/tests/InvalidTypeTest.php @@ -14,7 +14,7 @@ /** * @internal -*/ + */ final class InvalidTypeTest extends CBORTestCase { #[DataProvider('getInvalidDataItems')] @@ -31,8 +31,8 @@ public function invalidData(string $item, string $class, string $expectedError): } /** - * @see https://datatracker.ietf.org/doc/html/rfc8949#appendix-F.1 - */ + * @see https://datatracker.ietf.org/doc/html/rfc8949#appendix-F.1 + */ public static function getInvalidDataItems(): Iterator { yield [ diff --git a/tests/ListObjectTest.php b/tests/ListObjectTest.php index 840dcc8..1bdb7b1 100644 --- a/tests/ListObjectTest.php +++ b/tests/ListObjectTest.php @@ -12,7 +12,7 @@ /** * @internal -*/ + */ final class ListObjectTest extends CBORTestCase { #[Test] diff --git a/tests/MapObjectTest.php b/tests/MapObjectTest.php index 2bf4b0e..527b694 100644 --- a/tests/MapObjectTest.php +++ b/tests/MapObjectTest.php @@ -15,7 +15,7 @@ /** * @internal -*/ + */ final class MapObjectTest extends CBORTestCase { #[Test] diff --git a/tests/OtherObject/AllTest.php b/tests/OtherObject/AllTest.php index 606d8ce..4f1f8de 100644 --- a/tests/OtherObject/AllTest.php +++ b/tests/OtherObject/AllTest.php @@ -29,7 +29,7 @@ /** * @internal -*/ + */ final class AllTest extends CBORTestCase { #[Test] @@ -271,8 +271,8 @@ public static function getSimpleObjectWithContent(): Iterator } /** - * @see https://en.wikipedia.org/wiki/Half-precision_floating-point_format - */ + * @see https://en.wikipedia.org/wiki/Half-precision_floating-point_format + */ public static function getHalfPrecisionFloatObject(): Iterator { yield [self::bitsToByteString('0000000000000001', 2), 0.000000059604645, 0.000000000000001]; @@ -291,8 +291,8 @@ public static function getHalfPrecisionFloatObject(): Iterator } /** - * @see https://en.wikipedia.org/wiki/Single-precision_floating-point_format - */ + * @see https://en.wikipedia.org/wiki/Single-precision_floating-point_format + */ public static function getSinglePrecisionFloatObject(): Iterator { yield [self::bitsToByteString('00000000000000000000000000000001', 4), 2 ** -149, 10 ** -149]; @@ -320,8 +320,8 @@ public static function getSinglePrecisionFloatObject(): Iterator } /** - * @see https://en.wikipedia.org/wiki/Double-precision_floating-point_format - */ + * @see https://en.wikipedia.org/wiki/Double-precision_floating-point_format + */ public static function getDoublePrecisionFloatObject(): Iterator { yield [self::bitsToByteString('0011111111110000000000000000000000000000000000000000000000000000', 8), 1, 1]; diff --git a/tests/OtherTest.php b/tests/OtherTest.php index 6709db0..f496e1e 100644 --- a/tests/OtherTest.php +++ b/tests/OtherTest.php @@ -11,7 +11,7 @@ /** * @internal -*/ + */ final class OtherTest extends CBORTestCase { #[DataProvider('getDataSet')] diff --git a/tests/SignedIntegerTest.php b/tests/SignedIntegerTest.php index 993858a..6e2b57e 100644 --- a/tests/SignedIntegerTest.php +++ b/tests/SignedIntegerTest.php @@ -13,7 +13,7 @@ /** * @internal -*/ + */ final class SignedIntegerTest extends CBORTestCase { #[DataProvider('getValidValue')] diff --git a/tests/Tag/DatetimeTagTest.php b/tests/Tag/DatetimeTagTest.php index 40b6a1c..42d18dc 100644 --- a/tests/Tag/DatetimeTagTest.php +++ b/tests/Tag/DatetimeTagTest.php @@ -22,7 +22,7 @@ /** * @internal -*/ + */ final class DatetimeTagTest extends TestCase { #[DataProvider('getDatetimes')] diff --git a/tests/Tag/EncodingTagsTest.php b/tests/Tag/EncodingTagsTest.php index 8980882..622fd53 100644 --- a/tests/Tag/EncodingTagsTest.php +++ b/tests/Tag/EncodingTagsTest.php @@ -17,7 +17,7 @@ /** * @internal -*/ + */ final class EncodingTagsTest extends TestCase { #[Test] diff --git a/tests/Tag/MimeTagTest.php b/tests/Tag/MimeTagTest.php index 77defd8..8c36517 100644 --- a/tests/Tag/MimeTagTest.php +++ b/tests/Tag/MimeTagTest.php @@ -14,7 +14,7 @@ /** * @internal -*/ + */ final class MimeTagTest extends TestCase { #[Test] diff --git a/tests/Tag/SimpleTagsTest.php b/tests/Tag/SimpleTagsTest.php index e9f788d..4e7bb10 100644 --- a/tests/Tag/SimpleTagsTest.php +++ b/tests/Tag/SimpleTagsTest.php @@ -17,7 +17,7 @@ /** * @internal -*/ + */ final class SimpleTagsTest extends TestCase { #[Test] diff --git a/tests/TextStringObjectTest.php b/tests/TextStringObjectTest.php index 0d4001f..a88b528 100644 --- a/tests/TextStringObjectTest.php +++ b/tests/TextStringObjectTest.php @@ -13,7 +13,7 @@ /** * @internal -*/ + */ final class TextStringObjectTest extends CBORTestCase { #[DataProvider('getData')] diff --git a/tests/UnsignedIntegerTest.php b/tests/UnsignedIntegerTest.php index 2d5cc2e..75b65e9 100644 --- a/tests/UnsignedIntegerTest.php +++ b/tests/UnsignedIntegerTest.php @@ -13,7 +13,7 @@ /** * @internal -*/ + */ final class UnsignedIntegerTest extends CBORTestCase { #[DataProvider('getValidValue')] diff --git a/tests/VectorTest.php b/tests/VectorTest.php index 25c115a..e633375 100644 --- a/tests/VectorTest.php +++ b/tests/VectorTest.php @@ -11,7 +11,7 @@ /** * @internal -*/ + */ final class VectorTest extends CBORTestCase { #[DataProvider('getVectors')]