Skip to content

Commit d2a2cbd

Browse files
author
Maximilian Zumbansen
committed
[Serializer] [ObjectNormalizer] Use \is_string
1 parent f3903cd commit d2a2cbd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines 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

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy