Skip to content

Commit 5a37a76

Browse files
committed
middleware based hydrator
1 parent 5c4e315 commit 5a37a76

28 files changed

+454
-990
lines changed

baseline.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.12.0@cf420941d061a57050b6c468ef2c778faf40aee2">
2+
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51">
33
<file src="src/Attribute/SensitiveData.php">
44
<MixedPropertyTypeCoercion>
55
<code><![CDATA[$fallbackCallable]]></code>
@@ -47,7 +47,9 @@
4747
<MixedReturnStatement>
4848
<code><![CDATA[(new ReflectionClass($class))->newLazyProxy(
4949
function () use ($metadata, $data): object {
50-
return $this->doHydrate($metadata, $data);
50+
$stack = new Stack($this->middlewares);
51+
52+
return $stack->next()->hydrate($metadata, $data, $stack);
5153
},
5254
)]]></code>
5355
</MixedReturnStatement>
@@ -58,6 +60,12 @@
5860
]]]></code>
5961
</PossiblyInvalidArgument>
6062
</file>
63+
<file src="src/Middleware/TransformMiddleware.php">
64+
<MixedAssignment>
65+
<code><![CDATA[$data[$propertyMetadata->fieldName]]]></code>
66+
<code><![CDATA[$value]]></code>
67+
</MixedAssignment>
68+
</file>
6169
<file src="src/Normalizer/ArrayNormalizer.php">
6270
<MixedAssignment>
6371
<code><![CDATA[$item]]></code>
@@ -93,12 +101,6 @@
93101
<code><![CDATA[$sensitiveDataInfo]]></code>
94102
</MixedAssignment>
95103
</file>
96-
<file src="tests/Unit/Cryptography/CryptographySubscriberTest.php">
97-
<InvalidArgument>
98-
<code><![CDATA[$metadata]]></code>
99-
<code><![CDATA[$metadata]]></code>
100-
</InvalidArgument>
101-
</file>
102104
<file src="tests/Unit/Fixture/IdNormalizer.php">
103105
<PropertyTypeCoercion>
104106
<code><![CDATA[$type->getClassName()]]></code>
@@ -116,12 +118,6 @@
116118
<ArgumentTypeCoercion>
117119
<code><![CDATA['Unknown']]></code>
118120
</ArgumentTypeCoercion>
119-
<InvalidArgument>
120-
<code><![CDATA[$metadataFactory->metadata(ProfileCreated::class)]]></code>
121-
<code><![CDATA[$metadataFactory->metadata(ProfileCreated::class)]]></code>
122-
<code><![CDATA[$metadataFactory->metadata(ProfileCreated::class)]]></code>
123-
<code><![CDATA[$metadataFactory->metadata(ProfileCreated::class)]]></code>
124-
</InvalidArgument>
125121
<UndefinedClass>
126122
<code><![CDATA['Unknown']]></code>
127123
</UndefinedClass>

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"ext-openssl": "*",
2424
"psr/cache": "^2.0.0 || ^3.0.0",
2525
"psr/simple-cache": "^2.0.0 || ^3.0.0",
26-
"symfony/event-dispatcher": "^5.4.29 || ^6.4.0 || ^7.0.0",
2726
"symfony/type-info": "^7.3.0"
2827
},
2928
"require-dev": {

composer.lock

Lines changed: 8 additions & 218 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Attribute/PostHydrate.php

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

src/Attribute/PreExtract.php

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

src/Cryptography/CryptographyMetadataFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function metadata(string $class): ClassMetadata
3434

3535
if (array_key_exists($subjectIdIdentifier, $subjectIdMapping)) {
3636
throw new DuplicateSubjectIdIdentifier(
37-
$metadata->className(),
38-
$metadata->propertyForField($subjectIdMapping[$subjectIdIdentifier])->propertyName(),
39-
$property->propertyName(),
37+
$metadata->className,
38+
$metadata->propertyForField($subjectIdMapping[$subjectIdIdentifier])->propertyName,
39+
$property->propertyName,
4040
$subjectIdIdentifier,
4141
);
4242
}
@@ -53,7 +53,7 @@ public function metadata(string $class): ClassMetadata
5353
}
5454

5555
if ($isSubjectId) {
56-
throw new SubjectIdAndSensitiveDataConflict($metadata->className(), $property->propertyName());
56+
throw new SubjectIdAndSensitiveDataConflict($metadata->className, $property->propertyName);
5757
}
5858

5959
$property->extras[SensitiveDataInfo::class] = $sensitiveDataInfo;

0 commit comments

Comments
 (0)