Skip to content

Commit fda0885

Browse files
Remove all "nullable-by-default-value" setters
1 parent 78703a6 commit fda0885

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ CHANGELOG
44
6.2
55
---
66

7-
* Add support for constructor promoted properties to `Context` attribute
8-
* Add context option `PropertyNormalizer::NORMALIZE_VISIBILITY` with bitmask flags `PropertyNormalizer::NORMALIZE_PUBLIC`, `PropertyNormalizer::NORMALIZE_PROTECTED`, `PropertyNormalizer::NORMALIZE_PRIVATE`
9-
* Add method `withNormalizeVisibility` to `PropertyNormalizerContextBuilder`
7+
* Add support for constructor promoted properties to `Context` attribute
8+
* Add context option `PropertyNormalizer::NORMALIZE_VISIBILITY` with bitmask flags `PropertyNormalizer::NORMALIZE_PUBLIC`, `PropertyNormalizer::NORMALIZE_PROTECTED`, `PropertyNormalizer::NORMALIZE_PRIVATE`
9+
* Add method `withNormalizeVisibility` to `PropertyNormalizerContextBuilder`
10+
* Deprecate calling `AttributeMetadata::setSerializedName()`, `ClassMetadata::setClassDiscriminatorMapping()` without arguments
11+
* Change the signature of `AttributeMetadataInterface::setSerializedName()` to `setSerializedName(?string)`
12+
* Change the signature of `ClassMetadataInterface::setClassDiscriminatorMapping()` to `setClassDiscriminatorMapping(?ClassDiscriminatorMapping)`
1013

1114
6.1
1215
---

Mapping/AttributeMetadata.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public function getMaxDepth(): ?int
109109

110110
public function setSerializedName(string $serializedName = null)
111111
{
112+
if (1 > \func_num_args()) {
113+
trigger_deprecation('symfony/serializer', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
114+
}
115+
112116
$this->serializedName = $serializedName;
113117
}
114118

Mapping/AttributeMetadataInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getMaxDepth(): ?int;
5252
/**
5353
* Sets the serialization name for this attribute.
5454
*/
55-
public function setSerializedName(string $serializedName = null);
55+
public function setSerializedName(?string $serializedName);
5656

5757
/**
5858
* Gets the serialization name for this attribute.

Mapping/ClassMetadata.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping
9797

9898
public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null)
9999
{
100+
if (1 > \func_num_args()) {
101+
trigger_deprecation('symfony/serializer', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
102+
}
100103
$this->classDiscriminatorMapping = $mapping;
101104
}
102105

Mapping/ClassMetadataInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ public function getReflectionClass(): \ReflectionClass;
5353

5454
public function getClassDiscriminatorMapping(): ?ClassDiscriminatorMapping;
5555

56-
public function setClassDiscriminatorMapping(ClassDiscriminatorMapping $mapping = null);
56+
public function setClassDiscriminatorMapping(?ClassDiscriminatorMapping $mapping);
5757
}

0 commit comments

Comments
 (0)