diff --git a/composer.json b/composer.json index bca9b81..7f81601 100755 --- a/composer.json +++ b/composer.json @@ -44,14 +44,15 @@ "name": "petrknap/binary", "require": { "php": ">=8.1", - "petrknap/optional": "^3.1", - "petrknap/shorts": "^3.0" + "petrknap/has-requirements": "^1.0", + "petrknap/optional": "^3.1" }, "require-dev": { "ext-igbinary": "*", "ext-mbstring": "*", "ext-zlib": "*", "nunomaduro/phpinsights": "^2.11", + "petrknap/shorts": "^3.0", "petrknap/xz-utils": "*", "phpstan/phpstan": "^1.12", "phpunit/phpunit": "^10.5", diff --git a/src/Byter.php b/src/Byter.php index 7d081fc..a77a8e4 100644 --- a/src/Byter.php +++ b/src/Byter.php @@ -4,7 +4,7 @@ namespace PetrKnap\Binary; -use PetrKnap\Shorts\HasRequirements; +use PetrKnap\HasRequirements\HasRequirements; use RuntimeException; final class Byter diff --git a/src/Coder/Exception/CoderCouldNotDecodeData.php b/src/Coder/Exception/CoderCouldNotDecodeData.php index 81fce31..70e9c2a 100644 --- a/src/Coder/Exception/CoderCouldNotDecodeData.php +++ b/src/Coder/Exception/CoderCouldNotDecodeData.php @@ -4,7 +4,7 @@ namespace PetrKnap\Binary\Coder\Exception; -use PetrKnap\Shorts\Exception\CouldNotProcessData; +use PetrKnap\Binary\Exception\CouldNotProcessData; /** * @extends CouldNotProcessData diff --git a/src/Coder/Exception/CoderCouldNotEncodeData.php b/src/Coder/Exception/CoderCouldNotEncodeData.php index d3bf0f3..dcf19a1 100644 --- a/src/Coder/Exception/CoderCouldNotEncodeData.php +++ b/src/Coder/Exception/CoderCouldNotEncodeData.php @@ -4,7 +4,7 @@ namespace PetrKnap\Binary\Coder\Exception; -use PetrKnap\Shorts\Exception\CouldNotProcessData; +use PetrKnap\Binary\Exception\CouldNotProcessData; /** * @extends CouldNotProcessData diff --git a/src/Coder/Xz.php b/src/Coder/Xz.php index 287a903..be2316e 100644 --- a/src/Coder/Xz.php +++ b/src/Coder/Xz.php @@ -4,7 +4,7 @@ namespace PetrKnap\Binary\Coder; -use PetrKnap\Shorts\HasRequirements; +use PetrKnap\HasRequirements\HasRequirements; use PetrKnap\XzUtils\Xz as Inner; final class Xz extends Coder diff --git a/src/Coder/Zlib.php b/src/Coder/Zlib.php index 8c4cdf4..135186c 100644 --- a/src/Coder/Zlib.php +++ b/src/Coder/Zlib.php @@ -4,8 +4,8 @@ namespace PetrKnap\Binary\Coder; +use PetrKnap\HasRequirements\HasRequirements; use PetrKnap\Optional\OptionalString; -use PetrKnap\Shorts\HasRequirements; /** * @see zlib_encode() diff --git a/src/Exception/ByterCouldNotBiteData.php b/src/Exception/ByterCouldNotBiteData.php index e9c7067..17ce5c5 100644 --- a/src/Exception/ByterCouldNotBiteData.php +++ b/src/Exception/ByterCouldNotBiteData.php @@ -4,8 +4,6 @@ namespace PetrKnap\Binary\Exception; -use PetrKnap\Shorts\Exception\CouldNotProcessData; - /** * @extends CouldNotProcessData */ diff --git a/src/Exception/CouldNotProcessData.php b/src/Exception/CouldNotProcessData.php new file mode 100644 index 0000000..1c4ee0f --- /dev/null +++ b/src/Exception/CouldNotProcessData.php @@ -0,0 +1,35 @@ + + * @template TData of mixed + * + * @extends CouldNotProcessData */ final class SerializerCouldNotSerializeData extends CouldNotProcessData implements SerializerException { diff --git a/src/Serializer/Exception/SerializerCouldNotUnserializeData.php b/src/Serializer/Exception/SerializerCouldNotUnserializeData.php index 91475c9..5eb313a 100644 --- a/src/Serializer/Exception/SerializerCouldNotUnserializeData.php +++ b/src/Serializer/Exception/SerializerCouldNotUnserializeData.php @@ -4,7 +4,7 @@ namespace PetrKnap\Binary\Serializer\Exception; -use PetrKnap\Shorts\Exception\CouldNotProcessData; +use PetrKnap\Binary\Exception\CouldNotProcessData; /** * @extends CouldNotProcessData diff --git a/src/Serializer/Igbinary.php b/src/Serializer/Igbinary.php index 0a3c6db..262cba1 100644 --- a/src/Serializer/Igbinary.php +++ b/src/Serializer/Igbinary.php @@ -4,9 +4,9 @@ namespace PetrKnap\Binary\Serializer; +use PetrKnap\HasRequirements\HasRequirements; use PetrKnap\Optional\Optional; use PetrKnap\Optional\OptionalString; -use PetrKnap\Shorts\HasRequirements; /** * @see igbinary_serialize() diff --git a/src/Serializer/OneWaySelfSerializerInterface.php b/src/Serializer/OneWaySelfSerializerInterface.php index c361bb7..8ecaf29 100644 --- a/src/Serializer/OneWaySelfSerializerInterface.php +++ b/src/Serializer/OneWaySelfSerializerInterface.php @@ -9,7 +9,7 @@ interface OneWaySelfSerializerInterface /** * @return string binary representation of this instance * - * @throws Exception\SerializerCouldNotSerializeData + * @throws Exception\SerializerCouldNotSerializeData<$this> */ public function toBinary(): string; } diff --git a/src/Serializer/SerializerInterface.php b/src/Serializer/SerializerInterface.php index 305b79f..6c7b78e 100644 --- a/src/Serializer/SerializerInterface.php +++ b/src/Serializer/SerializerInterface.php @@ -7,7 +7,11 @@ interface SerializerInterface { /** - * @throws Exception\SerializerCouldNotSerializeData + * @template TSerializable of mixed + * + * @param TSerializable $serializable + * + * @throws Exception\SerializerCouldNotSerializeData */ public function serialize(mixed $serializable): string;