Skip to content

Commit 28d5727

Browse files
committed
More upmerge fixes: Remove Legacy implementation
1 parent 3c5b168 commit 28d5727

16 files changed

Lines changed: 11 additions & 640 deletions

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ phpunit: vendor
2727

2828
.PHONY: infection
2929
infection: vendor ## run infection
30-
XDEBUG_MODE=coverage vendor/bin/infection --threads=3
30+
XDEBUG_MODE=coverage php -d memory_limit=312M vendor/bin/infection --threads=3
3131

3232
.PHONY: static
3333
static: phpstan cs ## run static analysers

infection.json.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"mutators": {
1717
"@default": true
1818
},
19-
"minMsi": 89,
20-
"minCoveredMsi": 88,
19+
"minMsi": 91,
20+
"minCoveredMsi": 91,
2121
"testFrameworkOptions": "--testsuite=unit"
2222
}

phpstan-baseline.neon

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -48,78 +48,6 @@ parameters:
4848
count: 1
4949
path: src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php
5050

51-
-
52-
message: '#^Parameter \$legacyCryptographer of method Patchlevel\\Hydrator\\Extension\\Cryptography\\CryptographyExtension\:\:__construct\(\) has invalid type Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer\.$#'
53-
identifier: class.notFound
54-
count: 1
55-
path: src/Extension/Cryptography/CryptographyExtension.php
56-
57-
-
58-
message: '#^Property Patchlevel\\Hydrator\\Extension\\Cryptography\\CryptographyExtension\:\:\$legacyCryptographer has unknown class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer as its type\.$#'
59-
identifier: class.notFound
60-
count: 1
61-
path: src/Extension/Cryptography/CryptographyExtension.php
62-
63-
-
64-
message: '#^Call to method decrypt\(\) on an unknown class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer\.$#'
65-
identifier: class.notFound
66-
count: 1
67-
path: src/Extension/Cryptography/LegacyCryptographyDecryptMiddleware.php
68-
69-
-
70-
message: '#^Parameter \#2 \$data of method Patchlevel\\Hydrator\\Middleware\\Middleware\:\:hydrate\(\) expects array\<string, mixed\>, mixed given\.$#'
71-
identifier: argument.type
72-
count: 1
73-
path: src/Extension/Cryptography/LegacyCryptographyDecryptMiddleware.php
74-
75-
-
76-
message: '#^Parameter \$payloadCryptographer of method Patchlevel\\Hydrator\\Extension\\Cryptography\\LegacyCryptographyDecryptMiddleware\:\:__construct\(\) has invalid type Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer\.$#'
77-
identifier: class.notFound
78-
count: 1
79-
path: src/Extension/Cryptography/LegacyCryptographyDecryptMiddleware.php
80-
81-
-
82-
message: '#^Property Patchlevel\\Hydrator\\Extension\\Cryptography\\LegacyCryptographyDecryptMiddleware\:\:\$payloadCryptographer has unknown class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer as its type\.$#'
83-
identifier: class.notFound
84-
count: 1
85-
path: src/Extension/Cryptography/LegacyCryptographyDecryptMiddleware.php
86-
87-
-
88-
message: '#^Access to property \$fallback on an unknown class Patchlevel\\Hydrator\\Attribute\\PersonalData\.$#'
89-
identifier: class.notFound
90-
count: 1
91-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
92-
93-
-
94-
message: '#^Access to property \$fallbackCallable on an unknown class Patchlevel\\Hydrator\\Attribute\\PersonalData\.$#'
95-
identifier: class.notFound
96-
count: 2
97-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
98-
99-
-
100-
message: '#^Cannot access property \$nameToField on mixed\.$#'
101-
identifier: property.nonObject
102-
count: 1
103-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
104-
105-
-
106-
message: '#^Class Patchlevel\\Hydrator\\Attribute\\DataSubjectId not found\.$#'
107-
identifier: class.notFound
108-
count: 1
109-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
110-
111-
-
112-
message: '#^Class Patchlevel\\Hydrator\\Attribute\\PersonalData not found\.$#'
113-
identifier: class.notFound
114-
count: 1
115-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
116-
117-
-
118-
message: '#^Creating callable from mixed but it''s not a callable\.$#'
119-
identifier: callable.nonCallable
120-
count: 1
121-
path: src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php
122-
12351
-
12452
message: '#^Method Patchlevel\\Hydrator\\Guesser\\BuiltInGuesser\:\:guess\(\) has parameter \$type with generic class Symfony\\Component\\TypeInfo\\Type\\ObjectType but does not specify its types\: T$#'
12553
identifier: missingType.generics
@@ -168,12 +96,6 @@ parameters:
16896
count: 1
16997
path: src/Metadata/ClassMetadata.php
17098

171-
-
172-
message: '#^Access to constant OBJECT_TO_POPULATE on an unknown class Patchlevel\\Hydrator\\HydratorWithContext\.$#'
173-
identifier: class.notFound
174-
count: 2
175-
path: src/Middleware/TransformMiddleware.php
176-
17799
-
178100
message: '#^Method Patchlevel\\Hydrator\\Middleware\\TransformMiddleware\:\:hydrate\(\) should return T of object but returns mixed\.$#'
179101
identifier: return.type
@@ -186,12 +108,6 @@ parameters:
186108
count: 2
187109
path: src/Middleware/TransformMiddleware.php
188110

189-
-
190-
message: '#^Possibly invalid array key type mixed\.$#'
191-
identifier: offsetAccess.invalidOffset
192-
count: 2
193-
path: src/Middleware/TransformMiddleware.php
194-
195111
-
196112
message: '#^Attribute class Patchlevel\\Hydrator\\Normalizer\\Deprecated does not exist\.$#'
197113
identifier: attribute.notFound
@@ -216,42 +132,12 @@ parameters:
216132
count: 3
217133
path: src/StackHydrator.php
218134

219-
-
220-
message: '#^Class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer not found\.$#'
221-
identifier: class.notFound
222-
count: 1
223-
path: tests/Unit/Extension/Cryptography/CryptographyExtensionTest.php
224-
225135
-
226136
message: '#^Property Patchlevel\\Hydrator\\Tests\\Unit\\Extension\\Cryptography\\Fixture\\ChildWithSensitiveDataWithIdentifierDto\:\:\$email is never read, only written\.$#'
227137
identifier: property.onlyWritten
228138
count: 1
229139
path: tests/Unit/Extension/Cryptography/Fixture/ChildWithSensitiveDataWithIdentifierDto.php
230140

231-
-
232-
message: '#^Call to method expects\(\) on an unknown class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer\.$#'
233-
identifier: class.notFound
234-
count: 2
235-
path: tests/Unit/Extension/Cryptography/LegacyCryptographyDecryptMiddlewareTest.php
236-
237-
-
238-
message: '#^Class Patchlevel\\Hydrator\\Cryptography\\PayloadCryptographer not found\.$#'
239-
identifier: class.notFound
240-
count: 2
241-
path: tests/Unit/Extension/Cryptography/LegacyCryptographyDecryptMiddlewareTest.php
242-
243-
-
244-
message: '#^Attribute class Patchlevel\\Hydrator\\Attribute\\DataSubjectId does not exist\.$#'
245-
identifier: attribute.notFound
246-
count: 4
247-
path: tests/Unit/Extension/Cryptography/LegacyCryptographyMetadataEnricherTest.php
248-
249-
-
250-
message: '#^Attribute class Patchlevel\\Hydrator\\Attribute\\PersonalData does not exist\.$#'
251-
identifier: attribute.notFound
252-
count: 3
253-
path: tests/Unit/Extension/Cryptography/LegacyCryptographyMetadataEnricherTest.php
254-
255141
-
256142
message: '#^Property Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\IdNormalizer\:\:\$idClass \(class\-string\<Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\Id\>\|null\) does not accept string\.$#'
257143
identifier: assign.propertyType
@@ -288,26 +174,8 @@ parameters:
288174
count: 2
289175
path: tests/Unit/Normalizer/ArrayShapeNormalizerTest.php
290176

291-
-
292-
message: '#^Access to undefined constant Patchlevel\\Hydrator\\StackHydrator\:\:OBJECT_TO_POPULATE\.$#'
293-
identifier: classConstant.notFound
294-
count: 1
295-
path: tests/Unit/StackHydratorTest.php
296-
297177
-
298178
message: '#^Parameter \#1 \$class of method Patchlevel\\Hydrator\\StackHydrator\:\:hydrate\(\) expects class\-string\<Unknown\>, string given\.$#'
299179
identifier: argument.type
300180
count: 1
301181
path: tests/Unit/StackHydratorTest.php
302-
303-
-
304-
message: '#^Parameter \#3 \$context of method Patchlevel\\Hydrator\\StackHydrator\:\:hydrate\(\) expects array\<string, mixed\>, array\<Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\ProfileCreated\> given\.$#'
305-
identifier: argument.type
306-
count: 1
307-
path: tests/Unit/StackHydratorTest.php
308-
309-
-
310-
message: '#^Possibly invalid array key type mixed\.$#'
311-
identifier: array.invalidKey
312-
count: 1
313-
path: tests/Unit/StackHydratorTest.php

src/Extension/Cryptography/CryptographyExtension.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,19 @@
44

55
namespace Patchlevel\Hydrator\Extension\Cryptography;
66

7-
use Patchlevel\Hydrator\Cryptography\PayloadCryptographer;
87
use Patchlevel\Hydrator\Extension;
98
use Patchlevel\Hydrator\StackHydratorBuilder;
109

1110
final class CryptographyExtension implements Extension
1211
{
1312
public function __construct(
1413
private readonly Cryptographer $cryptography,
15-
private readonly PayloadCryptographer|null $legacyCryptographer = null,
16-
private readonly bool $legacyMetadataMapping = false,
1714
) {
1815
}
1916

2017
public function configure(StackHydratorBuilder $builder): void
2118
{
2219
$builder->addMetadataEnricher(new CryptographyMetadataEnricher(), 64);
2320
$builder->addMiddleware(new CryptographyMiddleware($this->cryptography), 64);
24-
25-
if ($this->legacyMetadataMapping) {
26-
$builder->addMetadataEnricher(new LegacyCryptographyMetadataEnricher(), 63);
27-
}
28-
29-
if ($this->legacyCryptographer === null) {
30-
return;
31-
}
32-
33-
$builder->addMiddleware(new LegacyCryptographyDecryptMiddleware($this->legacyCryptographer), 65);
3421
}
3522
}

src/Extension/Cryptography/CryptographyMiddleware.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ public function hydrate(ClassMetadata $metadata, array $data, array $context, St
3838
{
3939
$context[SubjectIds::class] = $subjectIds = $this->resolveSubjectIds($metadata, $data, $context);
4040

41-
if ($context[LegacyCryptographyDecryptMiddleware::class] ?? false) {
42-
unset($context[LegacyCryptographyDecryptMiddleware::class]);
43-
44-
return $stack->next()->hydrate($metadata, $data, $context, $stack);
45-
}
46-
4741
foreach ($metadata->properties as $propertyMetadata) {
4842
$info = $propertyMetadata->extras[SensitiveDataInfo::class] ?? null;
4943

src/Extension/Cryptography/LegacyCryptographyDecryptMiddleware.php

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

src/Extension/Cryptography/LegacyCryptographyMetadataEnricher.php

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

0 commit comments

Comments
 (0)