Skip to content

Commit de04183

Browse files
committed
Fix mapper configuration notes
1 parent e3c1fb6 commit de04183

File tree

1 file changed

+8
-42
lines changed

1 file changed

+8
-42
lines changed

Writerside/topics/mapper/mapper-configuration.md

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ $mapper = new TypeLang\Mapper\Mapper(
6666
This option is responsible for converting user defined objects
6767
PHP into associative arrays.
6868

69-
<note>
70-
This configuration option is enabled by default
71-
</note>
72-
7369
<note>
7470
This option is only applicable if the output can be an array or an object.
7571
For example, in the <a href="standard-platform.md">standard platform</a>.
@@ -84,20 +80,6 @@ be <b>enabled</b>:
8480
</warning>
8581

8682
<tabs>
87-
<tab title="default (null)">
88-
<code-block lang="php">
89-
<![CDATA[
90-
$config = new Configuration(objectAsArray: null);
91-
92-
$result = new Mapper(config: $config)
93-
->normalize((object)['key' => 'value']);
94-
95-
// array:1 [
96-
// "key" => "value"
97-
// ]
98-
]]>
99-
</code-block>
100-
</tab>
10183
<tab title="enabled (true)">
10284
<code-block lang="php">
10385
<![CDATA[
@@ -133,37 +115,21 @@ $result = new Mapper(config: $config)
133115
This option is responsible for disabling the strict comparison
134116
mode and attempts to coerce (cast) the values.
135117

136-
<note>
137-
This configuration option is disabled by default
138-
</note>
139-
140118
<tip>
141119
When this option is enabled, the corresponding cast rules
142120
defined in the <a href="type-coercers.md">type coercers</a> are enabled.
143121
</tip>
144122

145-
<tabs>
146-
<tab title="default (null)">
147-
<code-block lang="php">
148-
<![CDATA[
149-
$config = new Configuration(strictTypes: null);
150-
151-
$result = new Mapper(config: $config)
152-
->normalize(['k' => 42], 'list<string>');
153-
154-
// array:1 [
155-
// 0 => "42"
156-
// ]
123+
<warning>
124+
If the configuration value is not set, the option will
125+
be <b>disabled</b>:
126+
<list>
127+
<li><code>strictTypes: false</code></li>
128+
</list>
129+
</warning>
157130

158-
$result = new Mapper(config: $config)
159-
->denormalize(['k' => 42], 'list<string>');
160131

161-
// array:1 [
162-
// 0 => "42"
163-
// ]
164-
]]>
165-
</code-block>
166-
</tab>
132+
<tabs>
167133
<tab title="enabled (true)">
168134
<code-block lang="php">
169135
<![CDATA[

0 commit comments

Comments
 (0)