Skip to content

Commit 613a64a

Browse files
author
Kirill Nesmeyanov
committed
Replace "runtime" to "facade"
1 parent 9135187 commit 613a64a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+370
-367
lines changed

example/03.types/03.custom-type-template-arguments.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use TypeLang\Mapper\Platform\DelegatePlatform;
88
use TypeLang\Mapper\Platform\StandardPlatform;
99
use TypeLang\Mapper\Runtime\Context;
10-
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
11-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
10+
use TypeLang\Mapper\Runtime\Parser\TypeParserFacadeInterface;
11+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryFacadeInterface;
1212
use TypeLang\Mapper\Type\Builder\Builder;
1313
use TypeLang\Mapper\Type\TypeInterface;
1414
use TypeLang\Parser\Node\Stmt\NamedTypeNode;
@@ -28,8 +28,8 @@ public function isSupported(TypeStatement $statement): bool
2828

2929
public function build(
3030
TypeStatement $statement,
31-
TypeRepositoryInterface $types,
32-
TypeParserInterface $parser,
31+
TypeRepositoryFacadeInterface $types,
32+
TypeParserFacadeInterface $parser,
3333
): TypeInterface {
3434
// Shape fields not allowed (like: "non-empty{...}")
3535
$this->expectNoShapeFields($statement);

src/Mapper.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
use TypeLang\Mapper\Platform\StandardPlatform;
1212
use TypeLang\Mapper\Runtime\Configuration;
1313
use TypeLang\Mapper\Runtime\Context\RootContext;
14-
use TypeLang\Mapper\Runtime\Parser\InMemoryTypeParserRuntime;
15-
use TypeLang\Mapper\Runtime\Parser\LoggableTypeParserRuntime;
16-
use TypeLang\Mapper\Runtime\Parser\TraceableTypeParserRuntime;
14+
use TypeLang\Mapper\Runtime\Parser\InMemoryTypeParser;
15+
use TypeLang\Mapper\Runtime\Parser\LoggableTypeParser;
16+
use TypeLang\Mapper\Runtime\Parser\TraceableTypeParser;
17+
use TypeLang\Mapper\Runtime\Parser\TypeParserFacade;
18+
use TypeLang\Mapper\Runtime\Parser\TypeParserFacadeInterface;
1719
use TypeLang\Mapper\Runtime\Parser\TypeParser;
18-
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
19-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntime;
20-
use TypeLang\Mapper\Runtime\Repository\InMemoryTypeRepositoryRuntime;
21-
use TypeLang\Mapper\Runtime\Repository\LoggableTypeRepositoryRuntime;
22-
use TypeLang\Mapper\Runtime\Repository\TraceableTypeRepositoryRuntime;
20+
use TypeLang\Mapper\Runtime\Repository\InMemoryTypeRepository;
21+
use TypeLang\Mapper\Runtime\Repository\LoggableTypeRepository;
22+
use TypeLang\Mapper\Runtime\Repository\TraceableTypeRepository;
23+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryFacade;
24+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryFacadeInterface;
2325
use TypeLang\Mapper\Runtime\Repository\TypeRepository;
24-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
25-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntime;
2626
use TypeLang\Mapper\Type\TypeInterface;
2727

2828
final class Mapper implements NormalizerInterface, DenormalizerInterface
2929
{
30-
private readonly TypeRepositoryInterface $types;
30+
private readonly TypeRepositoryFacadeInterface $types;
3131

32-
private readonly TypeParserInterface $parser;
32+
private readonly TypeParserFacadeInterface $parser;
3333

3434
public function __construct(
3535
private readonly PlatformInterface $platform = new StandardPlatform(),
@@ -39,38 +39,38 @@ public function __construct(
3939
$this->types = $this->createTypeRepository($platform);
4040
}
4141

42-
private function createTypeParser(PlatformInterface $platform): TypeParserInterface
42+
private function createTypeParser(PlatformInterface $platform): TypeParserFacadeInterface
4343
{
44-
$runtime = TypeParserRuntime::createFromPlatform($platform);
44+
$runtime = TypeParser::createFromPlatform($platform);
4545

4646
if (($tracer = $this->config->getTracer()) !== null) {
47-
$runtime = new TraceableTypeParserRuntime($tracer, $runtime);
47+
$runtime = new TraceableTypeParser($tracer, $runtime);
4848
}
4949

5050
if (($logger = $this->config->getLogger()) !== null) {
51-
$runtime = new LoggableTypeParserRuntime($logger, $runtime);
51+
$runtime = new LoggableTypeParser($logger, $runtime);
5252
}
5353

54-
return new TypeParser(new InMemoryTypeParserRuntime(
54+
return new TypeParserFacade(new InMemoryTypeParser(
5555
delegate: $runtime,
5656
));
5757
}
5858

59-
private function createTypeRepository(PlatformInterface $platform): TypeRepositoryInterface
59+
private function createTypeRepository(PlatformInterface $platform): TypeRepositoryFacadeInterface
6060
{
61-
$runtime = TypeRepositoryRuntime::createFromPlatform($platform, $this->parser);
61+
$runtime = TypeRepository::createFromPlatform($platform, $this->parser);
6262

6363
if (($tracer = $this->config->getTracer()) !== null) {
64-
$runtime = new TraceableTypeRepositoryRuntime($tracer, $runtime);
64+
$runtime = new TraceableTypeRepository($tracer, $runtime);
6565
}
6666

6767
if (($logger = $this->config->getLogger()) !== null) {
68-
$runtime = new LoggableTypeRepositoryRuntime($logger, $runtime);
68+
$runtime = new LoggableTypeRepository($logger, $runtime);
6969
}
7070

71-
return new TypeRepository(
71+
return new TypeRepositoryFacade(
7272
parser: $this->parser,
73-
runtime: new InMemoryTypeRepositoryRuntime($runtime),
73+
runtime: new InMemoryTypeRepository($runtime),
7474
);
7575
}
7676

@@ -89,7 +89,7 @@ public function getPlatform(): PlatformInterface
8989
*
9090
* @api
9191
*/
92-
public function getTypes(): TypeRepositoryInterface
92+
public function getTypes(): TypeRepositoryFacadeInterface
9393
{
9494
return $this->types;
9595
}
@@ -99,7 +99,7 @@ public function getTypes(): TypeRepositoryInterface
9999
*
100100
* @api
101101
*/
102-
public function getParser(): TypeParserInterface
102+
public function getParser(): TypeParserFacadeInterface
103103
{
104104
return $this->parser;
105105
}

src/Mapping/Driver/AttributeDriver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
1212
use TypeLang\Mapper\Mapping\Metadata\TypeMetadata;
1313
use TypeLang\Mapper\Mapping\SkipWhen;
14-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
15-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
14+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
15+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1616

1717
final class AttributeDriver extends LoadableDriver
1818
{
1919
#[\Override]
2020
protected function load(
2121
\ReflectionClass $reflection,
2222
ClassMetadata $class,
23-
TypeRepositoryRuntimeInterface $types,
24-
TypeParserRuntimeInterface $parser,
23+
TypeRepositoryInterface $types,
24+
TypeParserInterface $parser,
2525
): void {
2626
foreach ($reflection->getProperties() as $property) {
2727
$metadata = $class->getPropertyOrCreate($property->getName());
@@ -71,8 +71,8 @@ protected function load(
7171
private function createType(
7272
string $type,
7373
\ReflectionProperty $property,
74-
TypeRepositoryRuntimeInterface $types,
75-
TypeParserRuntimeInterface $parser,
74+
TypeRepositoryInterface $types,
75+
TypeParserInterface $parser,
7676
): TypeMetadata {
7777
$statement = $parser->getStatementByDefinition($type);
7878

src/Mapping/Driver/DocBlockDriver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
1313
use TypeLang\Mapper\Mapping\Metadata\PropertyMetadata;
1414
use TypeLang\Mapper\Mapping\Metadata\TypeMetadata;
15-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
16-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
15+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
16+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1717
use TypeLang\Parser\Node\Stmt\TypeStatement;
1818
use TypeLang\PHPDoc\Parser;
1919
use TypeLang\PHPDoc\Standard\ParamTagFactory;
@@ -119,8 +119,8 @@ private function findType(\ReflectionClass $class, PropertyMetadata $meta): ?Typ
119119
protected function load(
120120
\ReflectionClass $reflection,
121121
ClassMetadata $class,
122-
TypeRepositoryRuntimeInterface $types,
123-
TypeParserRuntimeInterface $parser,
122+
TypeRepositoryInterface $types,
123+
TypeParserInterface $parser,
124124
): void {
125125
foreach ($reflection->getProperties() as $property) {
126126
$metadata = $class->getPropertyOrCreate($property->getName());

src/Mapping/Driver/Driver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace TypeLang\Mapper\Mapping\Driver;
66

77
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
8-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
9-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
8+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
9+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1010

1111
abstract class Driver implements DriverInterface
1212
{
@@ -16,8 +16,8 @@ public function __construct(
1616

1717
public function getClassMetadata(
1818
\ReflectionClass $class,
19-
TypeRepositoryRuntimeInterface $types,
20-
TypeParserRuntimeInterface $parser,
19+
TypeRepositoryInterface $types,
20+
TypeParserInterface $parser,
2121
): ClassMetadata {
2222
return $this->delegate->getClassMetadata($class, $types, $parser);
2323
}

src/Mapping/Driver/DriverInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace TypeLang\Mapper\Mapping\Driver;
66

77
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
8-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
9-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
8+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
9+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1010

1111
interface DriverInterface
1212
{
@@ -19,7 +19,7 @@ interface DriverInterface
1919
*/
2020
public function getClassMetadata(
2121
\ReflectionClass $class,
22-
TypeRepositoryRuntimeInterface $types,
23-
TypeParserRuntimeInterface $parser,
22+
TypeRepositoryInterface $types,
23+
TypeParserInterface $parser,
2424
): ClassMetadata;
2525
}

src/Mapping/Driver/InMemoryCachedDriver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace TypeLang\Mapper\Mapping\Driver;
66

77
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
8-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
9-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
8+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
9+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1010

1111
final class InMemoryCachedDriver extends Driver
1212
{
@@ -17,8 +17,8 @@ final class InMemoryCachedDriver extends Driver
1717

1818
public function getClassMetadata(
1919
\ReflectionClass $class,
20-
TypeRepositoryRuntimeInterface $types,
21-
TypeParserRuntimeInterface $parser,
20+
TypeRepositoryInterface $types,
21+
TypeParserInterface $parser,
2222
): ClassMetadata {
2323
// @phpstan-ignore-next-line : class-string<T> key contains ClassMetadata<T> instance
2424
return $this->memory[$class->name]

src/Mapping/Driver/LoadableDriver.php

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

77
use TypeLang\Mapper\Exception\Definition\DefinitionException;
88
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
9-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
10-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
9+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
10+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1111

1212
/**
1313
* Implements each driver that can supplement or modify existing
@@ -36,8 +36,8 @@ public function __construct(
3636
*/
3737
public function getClassMetadata(
3838
\ReflectionClass $class,
39-
TypeRepositoryRuntimeInterface $types,
40-
TypeParserRuntimeInterface $parser,
39+
TypeRepositoryInterface $types,
40+
TypeParserInterface $parser,
4141
): ClassMetadata {
4242
if (isset(self::$metadata[$class->getName()])) {
4343
/** @var ClassMetadata<TArg> */
@@ -68,7 +68,7 @@ public function getClassMetadata(
6868
abstract protected function load(
6969
\ReflectionClass $reflection,
7070
ClassMetadata $class,
71-
TypeRepositoryRuntimeInterface $types,
72-
TypeParserRuntimeInterface $parser,
71+
TypeRepositoryInterface $types,
72+
TypeParserInterface $parser,
7373
): void;
7474
}

src/Mapping/Driver/NullDriver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
namespace TypeLang\Mapper\Mapping\Driver;
66

77
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
8-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
9-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
8+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
9+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1010

1111
final class NullDriver implements DriverInterface
1212
{
1313
public function getClassMetadata(
1414
\ReflectionClass $class,
15-
TypeRepositoryRuntimeInterface $types,
16-
TypeParserRuntimeInterface $parser,
15+
TypeRepositoryInterface $types,
16+
TypeParserInterface $parser,
1717
): ClassMetadata {
1818
return new ClassMetadata($class->getName());
1919
}

src/Mapping/Driver/Psr16CachedDriver.php

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

77
use Psr\SimpleCache\CacheInterface;
88
use TypeLang\Mapper\Mapping\Metadata\ClassMetadata;
9-
use TypeLang\Mapper\Runtime\Parser\TypeParserRuntimeInterface;
10-
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryRuntimeInterface;
9+
use TypeLang\Mapper\Runtime\Parser\TypeParserInterface;
10+
use TypeLang\Mapper\Runtime\Repository\TypeRepositoryInterface;
1111

1212
final class Psr16CachedDriver extends CachedDriver
1313
{
@@ -22,8 +22,8 @@ public function __construct(
2222

2323
public function getClassMetadata(
2424
\ReflectionClass $class,
25-
TypeRepositoryRuntimeInterface $types,
26-
TypeParserRuntimeInterface $parser,
25+
TypeRepositoryInterface $types,
26+
TypeParserInterface $parser,
2727
): ClassMetadata {
2828
$index = $this->getKey($class);
2929

0 commit comments

Comments
 (0)