Skip to content

Commit 15420de

Browse files
committed
Update for PHP 8.4 compliance.
1 parent 7fb31cd commit 15420de

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

phpstan.neon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ parameters:
44
paths:
55
- src
66

7-
checkGenericClassInNonGenericObjectType: false
8-
checkMissingIterableValueType: false
7+
ignoreErrors:
8+
-
9+
identifier: missingType.iterableValue

src/DoctrineEntityNormalizer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class DoctrineEntityNormalizer extends AbstractObjectNormalizer
3030

3131
public function __construct(
3232
private readonly EntityManagerInterface $em,
33-
ClassMetadataFactoryInterface $classMetadataFactory = null,
33+
?ClassMetadataFactoryInterface $classMetadataFactory = null,
3434
array $defaultContext = []
3535
) {
3636
$defaultContext[AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES] = true;
@@ -72,7 +72,7 @@ public function normalize(
7272
* @param array $context
7373
* @return T
7474
*/
75-
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): object
75+
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): object
7676
{
7777
$context = $this->addDoctrineContext($type, $context);
7878

@@ -119,12 +119,12 @@ private function addDoctrineContext(
119119
return $context;
120120
}
121121

122-
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
122+
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
123123
{
124124
return $this->isEntity($data);
125125
}
126126

127-
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
127+
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
128128
{
129129
return $this->isEntity($type);
130130
}
@@ -148,7 +148,7 @@ protected function getAllowedAttributes(
148148
return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
149149
}
150150

151-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
151+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
152152
{
153153
$rawProps = (new ReflectionClass($object))->getProperties(
154154
ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED
@@ -176,7 +176,7 @@ protected function extractAttributes(object $object, string $format = null, arra
176176
protected function isAllowedAttribute(
177177
object|string $classOrObject,
178178
string $attribute,
179-
string $format = null,
179+
?string $format = null,
180180
array $context = []
181181
): bool {
182182
if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) {
@@ -217,7 +217,7 @@ private function hasGetter(ReflectionClass $reflectionClass, string $attribute):
217217
protected function getAttributeValue(
218218
object $object,
219219
string $attribute,
220-
string $format = null,
220+
?string $format = null,
221221
array $context = []
222222
): mixed {
223223
$formMode = $context[self::NORMALIZE_TO_IDENTIFIERS] ?? false;

0 commit comments

Comments
 (0)