Commit b51acf6 1 parent 3023390 commit b51acf6 Copy full SHA for b51acf6
File tree 12 files changed +42
-20
lines changed
MainTransformer/Implementation
ObjectCache/Implementation
12 files changed +42
-20
lines changed Original file line number Diff line number Diff line change 18
18
use Symfony \Bundle \FrameworkBundle \DataCollector \AbstractDataCollector ;
19
19
use Symfony \Component \HttpFoundation \Request ;
20
20
use Symfony \Component \HttpFoundation \Response ;
21
+ use Symfony \Contracts \Service \ResetInterface ;
21
22
22
23
/**
23
24
* @internal
24
25
*/
25
- final class MapperDataCollector extends AbstractDataCollector
26
+ final class MapperDataCollector extends AbstractDataCollector implements ResetInterface
26
27
{
27
28
public function getName (): string
28
29
{
@@ -135,4 +136,14 @@ public function getTotalTime(): float
135
136
$ this ->getMappings ()
136
137
));
137
138
}
139
+
140
+ public function reset (): void
141
+ {
142
+ $ this ->data = [];
143
+ $ this ->totalMappings = null ;
144
+ $ this ->totalMappingsIncludingSubMappings = null ;
145
+ $ this ->totalTime = null ;
146
+
147
+ parent ::reset ();
148
+ }
138
149
}
Original file line number Diff line number Diff line change 15
15
16
16
use Rekalogika \Mapper \Mapping \Mapping ;
17
17
use Rekalogika \Mapper \Mapping \MappingFactoryInterface ;
18
+ use Symfony \Contracts \Service \ResetInterface ;
18
19
19
20
/**
20
21
* @internal
21
22
*/
22
- final class TraceableMappingFactory implements MappingFactoryInterface
23
+ final class TraceableMappingFactory implements MappingFactoryInterface, ResetInterface
23
24
{
24
25
private bool $ mappingCollected = false ;
25
26
@@ -29,6 +30,11 @@ public function __construct(
29
30
) {
30
31
}
31
32
33
+ public function reset ()
34
+ {
35
+ $ this ->mappingCollected = false ;
36
+ }
37
+
32
38
public function getMapping (): Mapping
33
39
{
34
40
if ($ this ->mappingCollected ) {
Original file line number Diff line number Diff line change @@ -33,8 +33,6 @@ final class TraceableTransformer extends AbstractTransformerDecorator implements
33
33
{
34
34
use MainTransformerAwareTrait;
35
35
36
- private bool $ withMainTransformerCalled = false ;
37
-
38
36
public function __construct (
39
37
private TransformerInterface $ decorated ,
40
38
private MapperDataCollector $ dataCollector
@@ -48,17 +46,14 @@ public function getDecorated(): TransformerInterface
48
46
49
47
public function withMainTransformer (MainTransformerInterface $ mainTransformer ): static
50
48
{
51
- if ($ this ->withMainTransformerCalled ) {
49
+ if (! $ this ->decorated instanceof MainTransformerAwareInterface ) {
52
50
return $ this ;
53
51
}
54
52
55
- $ this ->withMainTransformerCalled = true ;
56
-
57
- if ($ this ->decorated instanceof MainTransformerAwareInterface) {
58
- $ this ->decorated = $ this ->decorated ->withMainTransformer ($ mainTransformer );
59
- }
53
+ $ clone = clone $ this ;
54
+ $ clone ->decorated = $ this ->decorated ->withMainTransformer ($ mainTransformer );
60
55
61
- return $ this ;
56
+ return $ clone ;
62
57
}
63
58
64
59
public function transform (
Original file line number Diff line number Diff line change 34
34
use Rekalogika \Mapper \Util \TypeCheck ;
35
35
use Rekalogika \Mapper \Util \TypeGuesser ;
36
36
use Symfony \Component \PropertyInfo \Type ;
37
+ use Symfony \Contracts \Service \ResetInterface ;
37
38
38
39
/**
39
40
* @internal
40
41
*/
41
- final class MainTransformer implements MainTransformerInterface
42
+ final class MainTransformer implements MainTransformerInterface, ResetInterface
42
43
{
43
44
public static int $ manualGcInterval = 500 ;
44
45
private static int $ runCounter = 1 ;
@@ -51,6 +52,11 @@ public function __construct(
51
52
) {
52
53
}
53
54
55
+ public function reset ()
56
+ {
57
+ self ::$ runCounter = 1 ;
58
+ }
59
+
54
60
private function processTransformer (
55
61
TransformerInterface $ transformer
56
62
): TransformerInterface {
Original file line number Diff line number Diff line change 17
17
use Rekalogika \Mapper \ObjectCache \ObjectCacheFactoryInterface ;
18
18
use Rekalogika \Mapper \TypeResolver \TypeResolverInterface ;
19
19
20
- final class ObjectCacheFactory implements ObjectCacheFactoryInterface
20
+ final readonly class ObjectCacheFactory implements ObjectCacheFactoryInterface
21
21
{
22
22
public function __construct (
23
23
private TypeResolverInterface $ typeResolver
Original file line number Diff line number Diff line change 16
16
/**
17
17
* @internal
18
18
*/
19
- class ProxyNamer
19
+ final readonly class ProxyNamer
20
20
{
21
+ public function __construct ()
22
+ {
23
+ }
24
+
21
25
/**
22
26
* @param class-string $class
23
27
*/
Original file line number Diff line number Diff line change 17
17
* @deprecated
18
18
* @phpstan-ignore-next-line
19
19
*/
20
- class DenormalizerContext extends AbstractSerializerContext
20
+ final class DenormalizerContext extends AbstractSerializerContext
21
21
{
22
22
}
Original file line number Diff line number Diff line change 17
17
* @deprecated
18
18
* @phpstan-ignore-next-line
19
19
*/
20
- class NormalizerContext extends AbstractSerializerContext
20
+ final class NormalizerContext extends AbstractSerializerContext
21
21
{
22
22
}
Original file line number Diff line number Diff line change 26
26
/**
27
27
* @internal
28
28
*/
29
- class ReaderWriter
29
+ final readonly class ReaderWriter
30
30
{
31
31
/**
32
32
* @throws UninitializedSourcePropertyException
Original file line number Diff line number Diff line change 17
17
use Rekalogika \Mapper \Transformer \MixedType ;
18
18
use Symfony \Component \PropertyInfo \Type ;
19
19
20
- final class TypeCheck
20
+ final readonly class TypeCheck
21
21
{
22
22
private function __construct ()
23
23
{
Original file line number Diff line number Diff line change 16
16
use Rekalogika \Mapper \Exception \InvalidArgumentException ;
17
17
use Symfony \Component \PropertyInfo \Type ;
18
18
19
- final class TypeGuesser
19
+ final readonly class TypeGuesser
20
20
{
21
21
private function __construct ()
22
22
{
Original file line number Diff line number Diff line change 24
24
use Rekalogika \Mapper \TypeResolver \Implementation \TypeResolver ;
25
25
use Symfony \Component \PropertyInfo \Type ;
26
26
27
- final class TypeUtil
27
+ final readonly class TypeUtil
28
28
{
29
29
private function __construct ()
30
30
{
You can’t perform that action at this time.
0 commit comments