Skip to content

Commit 9269ad8

Browse files
authored
Release/4.1.0 (#40)
1 parent eebd739 commit 9269ad8

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ show-reports:
3535

3636
clean:
3737
@sudo chown -R ${USER}:${USER} ${PWD}
38-
@rm -rf report vendor .phpunit.cache .lock
38+
@rm -rf report vendor .phpunit.cache *.lock

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"require": {
4848
"php": "^8.3",
4949
"psr/http-message": "^1.1",
50-
"tiny-blocks/serializer": "^3",
50+
"tiny-blocks/mapper": "^1",
5151
"ext-mbstring": "*"
5252
},
5353
"require-dev": {

src/Internal/Response/Stream/StreamFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use BackedEnum;
88
use Psr\Http\Message\StreamInterface;
9-
use TinyBlocks\Serializer\Serializer;
9+
use TinyBlocks\Mapper\Mapper;
1010
use UnitEnum;
1111

1212
final readonly class StreamFactory
@@ -21,7 +21,7 @@ private function __construct(private mixed $body)
2121
public static function fromBody(mixed $body): StreamFactory
2222
{
2323
$dataToWrite = match (true) {
24-
is_a($body, Serializer::class) => $body->toJson(),
24+
is_a($body, Mapper::class) => $body->toJson(),
2525
is_a($body, BackedEnum::class) => self::toJsonFrom(body: $body->value),
2626
is_a($body, UnitEnum::class) => $body->name,
2727
is_object($body) => self::toJsonFrom(body: get_object_vars($body)),

tests/Models/Order.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace TinyBlocks\Http\Models;
66

7-
use TinyBlocks\Serializer\Serializer;
8-
use TinyBlocks\Serializer\SerializerAdapter;
7+
use TinyBlocks\Mapper\ObjectMappability;
8+
use TinyBlocks\Mapper\ObjectMapper;
99

10-
final readonly class Order implements Serializer
10+
final readonly class Order implements ObjectMapper
1111
{
12-
use SerializerAdapter;
12+
use ObjectMappability;
1313

1414
public function __construct(public int $id, public Products $products)
1515
{

tests/Models/Product.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace TinyBlocks\Http\Models;
66

7-
use TinyBlocks\Serializer\Serializer;
8-
use TinyBlocks\Serializer\SerializerAdapter;
7+
use TinyBlocks\Mapper\ObjectMappability;
8+
use TinyBlocks\Mapper\ObjectMapper;
99

10-
final readonly class Product implements Serializer
10+
final readonly class Product implements ObjectMapper
1111
{
12-
use SerializerAdapter;
12+
use ObjectMappability;
1313

1414
public function __construct(public string $name, public Amount $amount)
1515
{

tests/Models/Products.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
use ArrayIterator;
88
use IteratorAggregate;
9-
use TinyBlocks\Serializer\Serializer;
10-
use TinyBlocks\Serializer\SerializerAdapter;
9+
use TinyBlocks\Mapper\IterableMappability;
10+
use TinyBlocks\Mapper\IterableMapper;
1111
use Traversable;
1212

13-
final class Products implements Serializer, IteratorAggregate
13+
final class Products implements IterableMapper, IteratorAggregate
1414
{
15-
use SerializerAdapter;
15+
use IterableMappability;
1616

1717
private array $elements;
1818

@@ -25,4 +25,9 @@ public function getIterator(): Traversable
2525
{
2626
return new ArrayIterator($this->elements);
2727
}
28+
29+
public function getType(): string
30+
{
31+
return Product::class;
32+
}
2833
}

0 commit comments

Comments
 (0)