File tree Expand file tree Collapse file tree 4 files changed +12
-19
lines changed
Expand file tree Collapse file tree 4 files changed +12
-19
lines changed Original file line number Diff line number Diff line change 1111use TypeLang \Mapper \Runtime \Extractor \TypeExtractorInterface ;
1212use TypeLang \Mapper \Runtime \Parser \TypeParserInterface ;
1313use TypeLang \Mapper \Runtime \Path \Entry \EntryInterface ;
14- use TypeLang \Mapper \Runtime \Path \Path ;
1514use TypeLang \Mapper \Runtime \Path \PathInterface ;
16- use TypeLang \Mapper \Runtime \Path \PathProviderInterface ;
1715use TypeLang \Mapper \Runtime \Repository \TypeRepositoryInterface ;
1816use TypeLang \Mapper \Runtime \Tracing \TracerInterface ;
1917use TypeLang \Mapper \Type \TypeInterface ;
2018use TypeLang \Parser \Node \Stmt \TypeStatement ;
2119
2220abstract class Context implements
2321 ConfigurationInterface,
24- PathProviderInterface,
2522 TypeExtractorInterface,
2623 TypeParserInterface,
2724 TypeRepositoryInterface
@@ -98,10 +95,7 @@ public function isDenormalization(): bool
9895 return $ this ->direction === Direction::Denormalize;
9996 }
10097
101- public function getPath (): PathInterface
102- {
103- return new Path ();
104- }
98+ abstract public function getPath (): PathInterface ;
10599
106100 public function getTypeByStatement (TypeStatement $ statement , ?\ReflectionClass $ context = null ): TypeInterface
107101 {
Original file line number Diff line number Diff line change 99use TypeLang \Mapper \Runtime \Context ;
1010use TypeLang \Mapper \Runtime \Extractor \TypeExtractorInterface ;
1111use TypeLang \Mapper \Runtime \Parser \TypeParserInterface ;
12+ use TypeLang \Mapper \Runtime \Path \Path ;
13+ use TypeLang \Mapper \Runtime \Path \PathInterface ;
1214use TypeLang \Mapper \Runtime \Repository \TypeRepositoryInterface ;
1315
1416/**
1719 */
1820final class RootContext extends Context
1921{
22+ private PathInterface $ path ;
23+
2024 public static function forNormalization (
2125 mixed $ value ,
2226 ConfigurationInterface $ config ,
@@ -68,4 +72,9 @@ public static function forDenormalization(
6872 config: $ config ,
6973 );
7074 }
75+
76+ public function getPath (): PathInterface
77+ {
78+ return $ this ->path ??= new Path ();
79+ }
7180}
Original file line number Diff line number Diff line change 99/**
1010 * @template-implements \IteratorAggregate<array-key, EntryInterface>
1111 */
12- class Path implements PathInterface, \IteratorAggregate
12+ final class Path implements PathInterface, \IteratorAggregate
1313{
1414 public function __construct (
1515 /**
1616 * @var list<EntryInterface>
1717 */
18- protected array $ entries = [],
18+ protected readonly array $ entries = [],
1919 ) {}
2020
2121 public function getIterator (): \Traversable
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments