Skip to content

Commit 29080a6

Browse files
Minor formatting changes
1 parent 2ef1b60 commit 29080a6

File tree

1 file changed

+50
-51
lines changed

1 file changed

+50
-51
lines changed

components/var_dumper/advanced.rst

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -182,93 +182,92 @@ them from re-implementing the logic required to walk through a
182182
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object's internal structure.
183183

184184
The :class:`Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper` limits string
185-
length and nesting depth of the output. These options can be overriden by
186-
providing a third parameter when calling
185+
length and nesting depth of the output to make it more readable. These options
186+
can be overriden by the third optional parameter of the
187187
:method:`dump(Data $data) <Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface::dump>`
188-
::
188+
method::
189189

190190
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
191191

192192
$output = fopen('php://memory', 'r+b');
193193

194194
$dumper = new HtmlDumper();
195195
$dumper->dump($var, $output, array(
196+
// 1 and 160 are the default values for these options
196197
'maxDepth' => 1,
197198
'maxStringLength' => 160
198199
));
199200

200-
// Limit nesting to 1 level and string length to 160 characters (default)
201-
202201
The output format of a dumper can be fine tuned by the two flags
203202
``DUMP_STRING_LENGTH`` and ``DUMP_LIGHT_ARRAY`` which are passed as a bitmap
204203
in the third constructor argument. They can also be set via environment
205204
variables when using
206205
:method:`assertDumpEquals($dump, $data, $message) <Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait::assertDumpEquals>`
207-
during unit testing. The flags can be configured in the PHPUnit configuration.
206+
during unit testing.
208207

209-
* If ``DUMP_STRING_LENGTH`` is set, then the length of a string is displayed
210-
next to its content.
208+
If ``DUMP_STRING_LENGTH`` is set, then the length of a string is displayed
209+
next to its content:
211210

212-
.. code-block:: php
211+
.. code-block:: php
213212
214-
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
215-
use Symfony\Component\VarDumper\Dumper\CliDumper;
213+
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
214+
use Symfony\Component\VarDumper\Dumper\CliDumper;
216215
217-
$var = array('test');
218-
$dumper = new CliDumper();
219-
echo $dumper->dump($var, true);
216+
$var = array('test');
217+
$dumper = new CliDumper();
218+
echo $dumper->dump($var, true);
220219
221-
// array:1 [
222-
// 0 => "test"
223-
// ]
220+
// array:1 [
221+
// 0 => "test"
222+
// ]
224223
225-
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
226-
echo $dumper->dump($var, true);
224+
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH);
225+
echo $dumper->dump($var, true);
227226
228-
// (added string length before the string)
229-
// array:1 [
230-
// 0 => (4) "test"
231-
// ]
227+
// (added string length before the string)
228+
// array:1 [
229+
// 0 => (4) "test"
230+
// ]
232231
233-
* If ``DUMP_LIGHT_ARRAY`` is set, then arrays are dumped in a shortened format
234-
similar to PHP's short array notation.
232+
If ``DUMP_LIGHT_ARRAY`` is set, then arrays are dumped in a shortened format
233+
similar to PHP's short array notation:
235234

236-
.. code-block:: php
235+
.. code-block:: php
237236
238-
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
239-
use Symfony\Component\VarDumper\Dumper\CliDumper;
237+
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
238+
use Symfony\Component\VarDumper\Dumper\CliDumper;
240239
241-
$var = array('test');
242-
$dumper = new CliDumper();
243-
echo $dumper->dump($var, true);
240+
$var = array('test');
241+
$dumper = new CliDumper();
242+
echo $dumper->dump($var, true);
244243
245-
// array:1 [
246-
// 0 => "test"
247-
// ]
244+
// array:1 [
245+
// 0 => "test"
246+
// ]
248247
249-
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
250-
echo $dumper->dump($var, true);
248+
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_LIGHT_ARRAY);
249+
echo $dumper->dump($var, true);
251250
252-
// (no more array:1 prefix)
253-
// [
254-
// 0 => "test"
255-
// ]
251+
// (no more array:1 prefix)
252+
// [
253+
// 0 => "test"
254+
// ]
256255
257-
* If you would like to use both options, then you can just
258-
combine them by using a the logical OR operator ``|``.
256+
If you would like to use both options, then you can just combine them by
257+
using a the logical OR operator ``|``:
259258

260-
.. code-block:: php
259+
.. code-block:: php
261260
262-
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
263-
use Symfony\Component\VarDumper\Dumper\CliDumper;
261+
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
262+
use Symfony\Component\VarDumper\Dumper\CliDumper;
264263
265-
$var = array('test');
266-
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
267-
echo $dumper->dump($var, true);
264+
$var = array('test');
265+
$dumper = new CliDumper(null, null, AbstractDumper::DUMP_STRING_LENGTH | AbstractDumper::DUMP_LIGHT_ARRAY);
266+
echo $dumper->dump($var, true);
268267
269-
// [
270-
// 0 => (4) "test"
271-
// ]
268+
// [
269+
// 0 => (4) "test"
270+
// ]
272271
273272
Casters
274273
-------

0 commit comments

Comments
 (0)