Skip to content

Commit 2c3cb2a

Browse files
committed
Disable strict types by default
1 parent c8359c2 commit 2c3cb2a

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/Context/RootContext.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ public static function forNormalization(
2626
TypeParserInterface $parser,
2727
TypeRepositoryInterface $types,
2828
): self {
29-
// Enable strict-types for normalization if option is not set
30-
if (!$config->isStrictTypesOptionDefined()) {
31-
$config = $config->withStrictTypes(true);
32-
}
33-
34-
// ...
35-
3629
return new self(
3730
value: $value,
3831
direction: Direction::Normalize,
@@ -50,13 +43,6 @@ public static function forDenormalization(
5043
TypeParserInterface $parser,
5144
TypeRepositoryInterface $types,
5245
): self {
53-
// Disable strict-types for denormalization if option is not set
54-
if (!$config->isStrictTypesOptionDefined()) {
55-
$config = $config->withStrictTypes(false);
56-
}
57-
58-
// ...
59-
6046
return new self(
6147
value: $value,
6248
direction: Direction::Denormalize,

tests/Context/ContextConfigMutationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function testOverrideConfig(): void
1515
{
1616
$context = $this->createNormalizationContext(42);
1717

18-
self::assertTrue($context->config->isStrictTypesEnabled());
18+
self::assertFalse($context->config->isStrictTypesEnabled());
1919
self::assertTrue($context->config->isObjectAsArray());
2020

2121
$context = $context->enter(42, new ObjectEntry('object'),
@@ -29,7 +29,7 @@ public function testConfigRollbackAfterEntrance(): void
2929
{
3030
$context = $this->createNormalizationContext(42);
3131

32-
self::assertTrue($context->config->isStrictTypesEnabled());
32+
self::assertFalse($context->config->isStrictTypesEnabled());
3333
self::assertTrue($context->config->isObjectAsArray());
3434

3535
$context = $context->enter(42, new ObjectEntry('object'),
@@ -40,15 +40,15 @@ public function testConfigRollbackAfterEntrance(): void
4040

4141
$context = $context->enter(42, new ObjectEntry('object'));
4242

43-
self::assertTrue($context->config->isStrictTypesEnabled());
43+
self::assertFalse($context->config->isStrictTypesEnabled());
4444
self::assertTrue($context->config->isObjectAsArray());
4545
}
4646

4747
public function testConfigRollbackAfterMultipleEntrance(): void
4848
{
4949
$context = $this->createNormalizationContext(42);
5050

51-
self::assertTrue($context->config->isStrictTypesEnabled());
51+
self::assertFalse($context->config->isStrictTypesEnabled());
5252
self::assertTrue($context->config->isObjectAsArray());
5353

5454
$context = $context->enter(42, new ObjectEntry('object'),
@@ -71,7 +71,7 @@ public function testConfigRollbackAfterMultipleEntrance(): void
7171

7272
$context = $context->enter(42, new ObjectEntry('object'));
7373

74-
self::assertTrue($context->config->isStrictTypesEnabled());
74+
self::assertFalse($context->config->isStrictTypesEnabled());
7575
self::assertTrue($context->config->isObjectAsArray());
7676
}
7777

0 commit comments

Comments
 (0)