Skip to content

Commit 3dd4026

Browse files
committed
Remove DirectionInterface
1 parent eef2f8d commit 3dd4026

File tree

4 files changed

+13
-38
lines changed

4 files changed

+13
-38
lines changed

src/Runtime/Context.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use JetBrains\PhpStorm\Language;
88
use Psr\Log\LoggerInterface;
99
use TypeLang\Mapper\Runtime\Context\ChildContext;
10-
use TypeLang\Mapper\Runtime\Context\DirectionInterface;
10+
use TypeLang\Mapper\Runtime\Context\Direction;
1111
use TypeLang\Mapper\Runtime\Extractor\TypeExtractorInterface;
1212
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
1313
use TypeLang\Mapper\Runtime\Path\Entry\EntryInterface;
@@ -24,12 +24,11 @@ abstract class Context implements
2424
PathProviderInterface,
2525
TypeExtractorInterface,
2626
TypeParserInterface,
27-
TypeRepositoryInterface,
28-
DirectionInterface
27+
TypeRepositoryInterface
2928
{
3029
protected function __construct(
3130
protected readonly mixed $value,
32-
protected readonly DirectionInterface $direction,
31+
protected readonly Direction $direction,
3332
protected readonly TypeExtractorInterface $extractor,
3433
protected readonly TypeParserInterface $parser,
3534
protected readonly TypeRepositoryInterface $types,
@@ -83,14 +82,20 @@ public function getTracer(): ?TracerInterface
8382
return $this->config->getTracer();
8483
}
8584

85+
/**
86+
* @api
87+
*/
8688
public function isNormalization(): bool
8789
{
88-
return $this->direction->isNormalization();
90+
return $this->direction === Direction::Normalize;
8991
}
9092

93+
/**
94+
* @api
95+
*/
9196
public function isDenormalization(): bool
9297
{
93-
return $this->direction->isDenormalization();
98+
return $this->direction === Direction::Denormalize;
9499
}
95100

96101
public function getPath(): PathInterface

src/Runtime/Context/ChildContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function __construct(
1919
private readonly Context $parent,
2020
private readonly EntryInterface $entry,
2121
mixed $value,
22-
DirectionInterface $direction,
22+
Direction $direction,
2323
TypeExtractorInterface $extractor,
2424
TypeParserInterface $parser,
2525
TypeRepositoryInterface $types,

src/Runtime/Context/Direction.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44

55
namespace TypeLang\Mapper\Runtime\Context;
66

7-
enum Direction implements DirectionInterface
7+
enum Direction
88
{
99
case Normalize;
1010
case Denormalize;
11-
12-
public function isNormalization(): bool
13-
{
14-
return $this === self::Normalize;
15-
}
16-
17-
public function isDenormalization(): bool
18-
{
19-
return $this === self::Denormalize;
20-
}
2111
}

src/Runtime/Context/DirectionInterface.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)