@@ -97,7 +97,7 @@ Dumpers
97
97
98
98
A dumper is responsible for outputting a string representation of a PHP variable,
99
99
using a :class: `Symfony\\ Component\\ VarDumper\\ Cloner\\ Data ` object as input.
100
- The destination and the formatting of this output vary with dumpers.
100
+ The destination and the formatting of this output vary with dumpers.
101
101
102
102
This component comes with an :class: `Symfony\\ Component\\ VarDumper\\ Dumper\\ HtmlDumper `
103
103
for HTML output and a :class: `Symfony\\ Component\\ VarDumper\\ Dumper\\ CliDumper `
@@ -204,70 +204,71 @@ The output format of a dumper can be fine tuned by the two flags
204
204
in the third constructor argument. They can also be set via environment
205
205
variables when using
206
206
:method: `assertDumpEquals($dump, $data, $message) <Symfony\\ Component\\ VarDumper\\ Test\\ VarDumperTestTrait::assertDumpEquals> `
207
- during unit testing. The flags can be configured in `` phpunit.xml.dist `` .
207
+ during unit testing. The flags can be configured in the PHPUnit configuration .
208
208
209
209
* If ``DUMP_STRING_LENGTH `` is set, then the length of a string is displayed
210
210
next to its content.
211
211
212
- ::
212
+ .. code-block :: php
213
213
214
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
215
- use Symfony\Component\VarDumper\Dumper\CliDumper;
214
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
215
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
216
216
217
- $var = array('test');
218
- $dumper = new CliDumper();
219
- echo $dumper->dump($var, true);
217
+ $var = array('test');
218
+ $dumper = new CliDumper();
219
+ echo $dumper->dump($var, true);
220
220
221
- // array:1 [
222
- // 0 => "test"
223
- // ]
221
+ // array:1 [
222
+ // 0 => "test"
223
+ // ]
224
224
225
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
226
- echo $dumper->dump($var, true);
225
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
226
+ echo $dumper->dump($var, true);
227
227
228
- // (added string length before the string)
229
- // array:1 [
230
- // 0 => (4) "test"
231
- // ]
228
+ // (added string length before the string)
229
+ // array:1 [
230
+ // 0 => (4) "test"
231
+ // ]
232
232
233
- * If ``DUMP_LIGHT_ARRAY `` is set, then arrays are dumped in a shortened format.
233
+ * If ``DUMP_LIGHT_ARRAY `` is set, then arrays are dumped in a shortened format
234
+ similar to PHP's short array notation.
234
235
235
- ::
236
+ .. code-block :: php
236
237
237
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
238
- use Symfony\Component\VarDumper\Dumper\CliDumper;
238
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
239
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
239
240
240
- $var = array('test');
241
- $dumper = new CliDumper();
242
- echo $dumper->dump($var, true);
241
+ $var = array('test');
242
+ $dumper = new CliDumper();
243
+ echo $dumper->dump($var, true);
243
244
244
- // array:1 [
245
- // 0 => "test"
246
- // ]
245
+ // array:1 [
246
+ // 0 => "test"
247
+ // ]
247
248
248
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
249
- echo $dumper->dump($var, true);
249
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
250
+ echo $dumper->dump($var, true);
250
251
251
- // (no more array:1 prefix)
252
- // [
253
- // 0 => "test"
254
- // ]
252
+ // (no more array:1 prefix)
253
+ // [
254
+ // 0 => "test"
255
+ // ]
255
256
256
257
* If you would like to use both options, then you can just
257
258
combine them by using a the logical OR operator ``| ``.
258
259
259
- ::
260
+ .. code-block :: php
260
261
261
- use Symfony\Component\VarDumper\Dumper\AbstractDumper;
262
- use Symfony\Component\VarDumper\Dumper\CliDumper;
262
+ use Symfony\Component\VarDumper\Dumper\AbstractDumper;
263
+ use Symfony\Component\VarDumper\Dumper\CliDumper;
263
264
264
- $var = array('test');
265
- $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
266
- echo $dumper->dump($var, true);
265
+ $var = array('test');
266
+ $dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
267
+ echo $dumper->dump($var, true);
267
268
268
- // [
269
- // 0 => (4) "test"
270
- // ]
269
+ // [
270
+ // 0 => (4) "test"
271
+ // ]
271
272
272
273
Casters
273
274
-------
0 commit comments