diff --git a/composer.json b/composer.json index 4fa1bda..0c72980 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "phpunit/phpunit": "^9.5" }, "require": { + "ext-json": "*", "rybakit/msgpack": "^0.9.0" }, "suggest": { diff --git a/src/Buybrain/Nervus/Adapter/Config/AdapterConfig.php b/src/Buybrain/Nervus/Adapter/Config/AdapterConfig.php index b0403ae..0714ed4 100644 --- a/src/Buybrain/Nervus/Adapter/Config/AdapterConfig.php +++ b/src/Buybrain/Nervus/Adapter/Config/AdapterConfig.php @@ -30,10 +30,7 @@ public function __construct($codec, $adapterType, ExtraAdapterConfig $extra = nu $this->extra = $extra; } - /** - * @return array - */ - function jsonSerialize() + function jsonSerialize(): array { return [ 'codec' => $this->codec, diff --git a/src/Buybrain/Nervus/Adapter/Config/SignalAdapterConfig.php b/src/Buybrain/Nervus/Adapter/Config/SignalAdapterConfig.php index d4ba3d8..c257b84 100644 --- a/src/Buybrain/Nervus/Adapter/Config/SignalAdapterConfig.php +++ b/src/Buybrain/Nervus/Adapter/Config/SignalAdapterConfig.php @@ -23,10 +23,7 @@ public function __construct($interval, $priority) $this->priority = (int)$priority; } - /** - * @return array - */ - function jsonSerialize() + function jsonSerialize(): array { return [ 'interval' => $this->interval, diff --git a/src/Buybrain/Nervus/Adapter/Config/TypedAdapterConfig.php b/src/Buybrain/Nervus/Adapter/Config/TypedAdapterConfig.php index 7877313..e47936f 100644 --- a/src/Buybrain/Nervus/Adapter/Config/TypedAdapterConfig.php +++ b/src/Buybrain/Nervus/Adapter/Config/TypedAdapterConfig.php @@ -19,10 +19,7 @@ public function __construct(array $entityTypes = null) $this->entityTypes = $entityTypes; } - /** - * @return array - */ - function jsonSerialize() + function jsonSerialize(): array { return [ 'entityTypes' => $this->entityTypes, diff --git a/src/Buybrain/Nervus/Adapter/Message/AbstractResponse.php b/src/Buybrain/Nervus/Adapter/Message/AbstractResponse.php index 8e7203f..49fe504 100644 --- a/src/Buybrain/Nervus/Adapter/Message/AbstractResponse.php +++ b/src/Buybrain/Nervus/Adapter/Message/AbstractResponse.php @@ -55,10 +55,7 @@ public static function fromArray(array $data, StructMapper $mapper) return new static($data['status'], $data['error']); } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'status' => $this->status, diff --git a/src/Buybrain/Nervus/Adapter/Message/ReadRequest.php b/src/Buybrain/Nervus/Adapter/Message/ReadRequest.php index 5f4496f..4fe39e8 100644 --- a/src/Buybrain/Nervus/Adapter/Message/ReadRequest.php +++ b/src/Buybrain/Nervus/Adapter/Message/ReadRequest.php @@ -43,10 +43,7 @@ public static function fromArray(array $data, StructMapper $mapper) return new self($ids); } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return ['ids' => $this->ids]; } diff --git a/src/Buybrain/Nervus/Adapter/Message/ReadResponse.php b/src/Buybrain/Nervus/Adapter/Message/ReadResponse.php index 51bd9f0..2b4ddfd 100644 --- a/src/Buybrain/Nervus/Adapter/Message/ReadResponse.php +++ b/src/Buybrain/Nervus/Adapter/Message/ReadResponse.php @@ -42,10 +42,7 @@ public static function fromArray(array $data, StructMapper $mapper) return $res; } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return array_merge(parent::jsonSerialize(), ['entities' => $this->entities]); } diff --git a/src/Buybrain/Nervus/Adapter/Message/Signal.php b/src/Buybrain/Nervus/Adapter/Message/Signal.php index ab54f8a..01561f7 100644 --- a/src/Buybrain/Nervus/Adapter/Message/Signal.php +++ b/src/Buybrain/Nervus/Adapter/Message/Signal.php @@ -41,10 +41,7 @@ public static function fromArray(array $data, StructMapper $mapper) }, $data['ids'])); } - /** - * @return array - */ - function jsonSerialize() + function jsonSerialize(): array { return [ 'ids' => $this->ids, diff --git a/src/Buybrain/Nervus/Adapter/Message/SignalAckRequest.php b/src/Buybrain/Nervus/Adapter/Message/SignalAckRequest.php index dcda696..1378a19 100644 --- a/src/Buybrain/Nervus/Adapter/Message/SignalAckRequest.php +++ b/src/Buybrain/Nervus/Adapter/Message/SignalAckRequest.php @@ -36,10 +36,7 @@ public static function fromArray(array $data) return new self($data['ack']); } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return ['ack' => $this->ack]; } diff --git a/src/Buybrain/Nervus/Adapter/Message/SignalRequest.php b/src/Buybrain/Nervus/Adapter/Message/SignalRequest.php index bddd59b..47452fc 100644 --- a/src/Buybrain/Nervus/Adapter/Message/SignalRequest.php +++ b/src/Buybrain/Nervus/Adapter/Message/SignalRequest.php @@ -11,7 +11,7 @@ class SignalRequest implements JsonSerializable /** * @return array */ - public function jsonSerialize() + public function jsonSerialize(): array { return []; } diff --git a/src/Buybrain/Nervus/Adapter/Message/SignalResponse.php b/src/Buybrain/Nervus/Adapter/Message/SignalResponse.php index ed30769..2c96dd7 100644 --- a/src/Buybrain/Nervus/Adapter/Message/SignalResponse.php +++ b/src/Buybrain/Nervus/Adapter/Message/SignalResponse.php @@ -37,10 +37,7 @@ public static function fromArray(array $data, StructMapper $mapper) return $res; } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return array_merge(parent::jsonSerialize(), ['signal' => $this->signal]); } diff --git a/src/Buybrain/Nervus/Adapter/Message/WriteRequest.php b/src/Buybrain/Nervus/Adapter/Message/WriteRequest.php index f13ffe5..bf37e62 100644 --- a/src/Buybrain/Nervus/Adapter/Message/WriteRequest.php +++ b/src/Buybrain/Nervus/Adapter/Message/WriteRequest.php @@ -42,10 +42,7 @@ public static function fromArray(array $data, StructMapper $mapper) return new self($entities); } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'entities' => $this->entities, diff --git a/src/Buybrain/Nervus/Entity.php b/src/Buybrain/Nervus/Entity.php index 04c1f06..d633306 100644 --- a/src/Buybrain/Nervus/Entity.php +++ b/src/Buybrain/Nervus/Entity.php @@ -49,10 +49,7 @@ public function getData() return $this->data; } - /** - * return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'id' => $this->id, diff --git a/src/Buybrain/Nervus/EntityId.php b/src/Buybrain/Nervus/EntityId.php index b3e4870..0e4683f 100644 --- a/src/Buybrain/Nervus/EntityId.php +++ b/src/Buybrain/Nervus/EntityId.php @@ -42,10 +42,7 @@ public function getId() return $this->id; } - /** - * @return array - */ - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'type' => $this->type,