Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d2a2cbd

Browse filesBrowse files
author
Maximilian Zumbansen
committed
[Serializer] [ObjectNormalizer] Use \is_string
1 parent f3903cd commit d2a2cbd
Copy full SHA for d2a2cbd

File tree

2 files changed

+3
-3
lines changed
Filter options

2 files changed

+3
-3
lines changed

‎src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private function validateAndDenormalizeLegacy(array $types, string $currentClass
566566
return (float) $data;
567567
}
568568

569-
if (LegacyType::BUILTIN_TYPE_BOOL === $builtinType && is_string($data) && ($context[self::FILTER_BOOL] ?? false)) {
569+
if (LegacyType::BUILTIN_TYPE_BOOL === $builtinType && \is_string($data) && ($context[self::FILTER_BOOL] ?? false)) {
570570
return filter_var($data, \FILTER_VALIDATE_BOOL, \FILTER_NULL_ON_FAILURE);
571571
}
572572

@@ -791,7 +791,7 @@ private function validateAndDenormalize(Type $type, string $currentClass, string
791791
return (float) $data;
792792
}
793793

794-
if (TypeIdentifier::BOOL === $typeIdentifier && is_string($data) && ($context[self::FILTER_BOOL] ?? false)) {
794+
if (TypeIdentifier::BOOL === $typeIdentifier && \is_string($data) && ($context[self::FILTER_BOOL] ?? false)) {
795795
return filter_var($data, \FILTER_VALIDATE_BOOL, \FILTER_NULL_ON_FAILURE);
796796
}
797797

‎src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ public function testDenormalizeBooleanTypeWithFilterBool(array $data, ?bool $exp
12051205

12061206
$dummy = $normalizer->denormalize($data, BoolPropertyDummy::class, null, [AbstractNormalizer::FILTER_BOOL => true]);
12071207

1208-
self::assertSame($expectedFoo, $dummy->foo);
1208+
$this->assertSame($expectedFoo, $dummy->foo);
12091209
}
12101210

12111211
public function provideDenormalizeWithFilterBoolData()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.