Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/JsonObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public function fromJsonString(string $jsonString):JsonObject {
return $this->fromJsonDecoded($json);
}

/**
* @param object|array<mixed>|string|int|float|bool|null $jsonDecoded
*/
public function fromJsonDecoded(
object|array|string|int|float|bool|null $jsonDecoded
):JsonObject {
Expand Down Expand Up @@ -68,4 +71,4 @@ public function fromJsonDecoded(

return $jsonData;
}
}
}
4 changes: 2 additions & 2 deletions src/JsonPrimitive/JsonArrayPrimitive.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace Gt\Json\JsonPrimitive;

class JsonArrayPrimitive extends JsonPrimitive {
/** @return mixed[] */
/** @return array<mixed> */
public function getPrimitiveValue():array {
return (array)$this->value;
}
}
}
4 changes: 2 additions & 2 deletions src/JsonPrimitive/JsonNullPrimitive.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Gt\Json\JsonPrimitive;

class JsonNullPrimitive extends JsonPrimitive {
public function getPrimitiveValue() {
public function getPrimitiveValue():mixed {
return null;
}
}
}
8 changes: 6 additions & 2 deletions src/JsonPrimitive/JsonPrimitive.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
use Gt\Json\JsonObject;

abstract class JsonPrimitive extends JsonObject {
/** @var bool|int|float|string|array<mixed>|null */
protected bool|int|float|string|array|null $value;

abstract public function getPrimitiveValue();
abstract public function getPrimitiveValue():mixed;

/**
* @param bool|int|float|string|array<mixed>|null $value
*/
public function withPrimitiveValue(
bool|int|float|string|array|null $value
):static {
$clone = clone $this;
$clone->value = $value;
return $clone;
}
}
}