Skip to content

Commit 9fa1c11

Browse files
Henry Snoekwouterj
Henry Snoek
authored andcommitted
5177 use var_dump() in components
Conflicts: components/expression_language/caching.rst components/expression_language/extending.rst components/expression_language/introduction.rst components/expression_language/syntax.rst components/serializer.rst
1 parent c2acbee commit 9fa1c11

File tree

12 files changed

+37
-37
lines changed

12 files changed

+37
-37
lines changed

components/class_loader/class_map_generator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ method::
5050

5151
use Symfony\Component\ClassLoader\ClassMapGenerator;
5252

53-
dump(ClassMapGenerator::createMap(__DIR__.'/library'));
53+
var_dump(ClassMapGenerator::createMap(__DIR__.'/library'));
5454

5555
Given the files and class from the table above, you should see an output like
5656
this:

components/css_selector.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ equivalents::
5151

5252
use Symfony\Component\CssSelector\CssSelector;
5353

54-
dump(CssSelector::toXPath('div.item > h4 > a'));
54+
var_dump(CssSelector::toXPath('div.item > h4 > a'));
5555

5656
This gives the following output:
5757

components/dom_crawler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ traverse easily::
4747
$crawler = new Crawler($html);
4848

4949
foreach ($crawler as $domElement) {
50-
dump($domElement->nodeName);
50+
var_dump($domElement->nodeName);
5151
}
5252

5353
Specialized :class:`Symfony\\Component\\DomCrawler\\Link` and

components/event_dispatcher/generic_event.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ the event arguments::
7575
);
7676
$dispatcher->dispatch('foo', $event);
7777

78-
dump($event['counter']);
78+
var_dump($event['counter']);
7979

8080
class FooListener
8181
{
@@ -96,7 +96,7 @@ Filtering data::
9696
$event = new GenericEvent($subject, array('data' => 'Foo'));
9797
$dispatcher->dispatch('foo', $event);
9898

99-
dump($event['data']);
99+
var_dump($event['data']);
100100

101101
class FooListener
102102
{

components/finder.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ directories::
3131

3232
foreach ($finder as $file) {
3333
// Dump the absolute path
34-
dump($file->getRealpath());
34+
var_dump($file->getRealpath());
3535

3636
// Dump the relative path to the file, omitting the filename
37-
dump($file->getRelativePath());
37+
var_dump($file->getRelativePath());
3838

3939
// Dump the relative path to the file
40-
dump($file->getRelativePathname());
40+
var_dump($file->getRelativePathname());
4141
}
4242

4343
The ``$file`` is an instance of :class:`Symfony\\Component\\Finder\\SplFileInfo`

components/form/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ is created from the form factory.
396396
->add('dueDate', 'date')
397397
->getForm();
398398
399-
dump($twig->render('new.html.twig', array(
399+
var_dump($twig->render('new.html.twig', array(
400400
'form' => $form->createView(),
401401
)));
402402

components/http_foundation/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,10 @@ represented by a PHP callable instead of a string::
415415

416416
$response = new StreamedResponse();
417417
$response->setCallback(function () {
418-
dump('Hello World');
418+
var_dump('Hello World');
419419
flush();
420420
sleep(2);
421-
dump('Hello World');
421+
var_dump('Hello World');
422422
flush();
423423
});
424424
$response->send();

components/intl.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ This class currently only works with the `intl extension`_ installed::
217217
$reader = new BinaryBundleReader();
218218
$data = $reader->read('/path/to/bundle', 'en');
219219

220-
dump($data['Data']['entry1']);
220+
var_dump($data['Data']['entry1']);
221221

222222
PhpBundleReader
223223
~~~~~~~~~~~~~~~
@@ -231,7 +231,7 @@ object::
231231
$reader = new PhpBundleReader();
232232
$data = $reader->read('/path/to/bundle', 'en');
233233

234-
dump($data['Data']['entry1']);
234+
var_dump($data['Data']['entry1']);
235235

236236
BufferedBundleReader
237237
~~~~~~~~~~~~~~~~~~~~
@@ -272,10 +272,10 @@ returned::
272272
$data = $reader->read('/path/to/bundle', 'en');
273273

274274
// Produces an error if the key "Data" does not exist
275-
dump($data['Data']['entry1']);
275+
var_dump($data['Data']['entry1']);
276276

277277
// Returns null if the key "Data" does not exist
278-
dump($reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1')));
278+
var_dump($reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1')));
279279

280280
Additionally, the
281281
:method:`Symfony\\Component\\Intl\\ResourceBundle\\Reader\\StructuredBundleReaderInterface::readEntry`
@@ -286,7 +286,7 @@ multi-valued entries (arrays), the values of the more specific and the fallback
286286
locale will be merged. In order to suppress this behavior, the last parameter
287287
``$fallback`` can be set to ``false``::
288288

289-
dump($reader->readEntry(
289+
var_dump($reader->readEntry(
290290
'/path/to/bundle',
291291
'en',
292292
array('Data', 'entry1'),

components/property_access/introduction.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ method. This is done using the index notation that is used in PHP::
5151
'first_name' => 'Wouter',
5252
);
5353

54-
dump($accessor->getValue($person, '[first_name]')); // 'Wouter'
55-
dump($accessor->getValue($person, '[age]')); // null
54+
var_dump($accessor->getValue($person, '[first_name]')); // 'Wouter'
55+
var_dump($accessor->getValue($person, '[age]')); // null
5656

5757
As you can see, the method will return ``null`` if the index does not exists.
5858

@@ -86,13 +86,13 @@ To read from properties, use the "dot" notation::
8686
$person = new Person();
8787
$person->firstName = 'Wouter';
8888

89-
dump($accessor->getValue($person, 'firstName')); // 'Wouter'
89+
var_dump($accessor->getValue($person, 'firstName')); // 'Wouter'
9090

9191
$child = new Person();
9292
$child->firstName = 'Bar';
9393
$person->children = array($child);
9494

95-
dump($accessor->getValue($person, 'children[0].firstName')); // 'Bar'
95+
var_dump($accessor->getValue($person, 'children[0].firstName')); // 'Bar'
9696

9797
.. caution::
9898

@@ -122,7 +122,7 @@ property name (``first_name`` becomes ``FirstName``) and prefixes it with
122122

123123
$person = new Person();
124124

125-
dump($accessor->getValue($person, 'first_name')); // 'Wouter'
125+
var_dump($accessor->getValue($person, 'first_name')); // 'Wouter'
126126

127127
Using Hassers/Issers
128128
~~~~~~~~~~~~~~~~~~~~
@@ -151,10 +151,10 @@ getters, this means that you can do something like this::
151151
$person = new Person();
152152

153153
if ($accessor->getValue($person, 'author')) {
154-
dump('He is an author');
154+
var_dump('He is an author');
155155
}
156156
if ($accessor->getValue($person, 'children')) {
157-
dump('He has children');
157+
var_dump('He has children');
158158
}
159159

160160
This will produce: ``He is an author``
@@ -179,7 +179,7 @@ The ``getValue`` method can also use the magic ``__get`` method::
179179

180180
$person = new Person();
181181

182-
dump($accessor->getValue($person, 'Wouter')); // array(...)
182+
var_dump($accessor->getValue($person, 'Wouter')); // array(...)
183183

184184
Magic ``__call()`` Method
185185
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -215,7 +215,7 @@ enable this feature by using :class:`Symfony\\Component\\PropertyAccess\\Propert
215215
->enableMagicCall()
216216
->getPropertyAccessor();
217217

218-
dump($accessor->getValue($person, 'wouter')); // array(...)
218+
var_dump($accessor->getValue($person, 'wouter')); // array(...)
219219

220220
.. versionadded:: 2.3
221221
The use of magic ``__call()`` method was introduced in Symfony 2.3.
@@ -239,9 +239,9 @@ method::
239239

240240
$accessor->setValue($person, '[first_name]', 'Wouter');
241241

242-
dump($accessor->getValue($person, '[first_name]')); // 'Wouter'
242+
var_dump($accessor->getValue($person, '[first_name]')); // 'Wouter'
243243
// or
244-
// dump($person['first_name']); // 'Wouter'
244+
// var_dump($person['first_name']); // 'Wouter'
245245

246246
Writing to Objects
247247
------------------
@@ -275,9 +275,9 @@ can use setters, the magic ``__set`` method or properties to set values::
275275
$accessor->setValue($person, 'lastName', 'de Jong');
276276
$accessor->setValue($person, 'children', array(new Person()));
277277

278-
dump($person->firstName); // 'Wouter'
279-
dump($person->getLastName()); // 'de Jong'
280-
dump($person->children); // array(Person());
278+
var_dump($person->firstName); // 'Wouter'
279+
var_dump($person->getLastName()); // 'de Jong'
280+
var_dump($person->children); // array(Person());
281281

282282
You can also use ``__call`` to set values but you need to enable the feature,
283283
see `Enable other Features`_.
@@ -313,7 +313,7 @@ see `Enable other Features`_.
313313
314314
$accessor->setValue($person, 'wouter', array(...));
315315
316-
dump($person->getWouter()); // array(...)
316+
var_dump($person->getWouter()); // array(...)
317317
318318
Mixing Objects and Arrays
319319
-------------------------
@@ -345,7 +345,7 @@ You can also mix objects and arrays::
345345
$accessor->setValue($person, 'children[0].firstName', 'Wouter');
346346
// equal to $person->getChildren()[0]->firstName = 'Wouter'
347347

348-
dump('Hello '.$accessor->getValue($person, 'children[0].firstName')); // 'Wouter'
348+
var_dump('Hello '.$accessor->getValue($person, 'children[0].firstName')); // 'Wouter'
349349
// equal to $person->getChildren()[0]->firstName
350350

351351
Enable other Features

components/security/authorization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ first constructor argument::
187187
$role = new Role('ROLE_ADMIN');
188188

189189
// will show 'ROLE_ADMIN'
190-
dump($role->getRole());
190+
var_dump($role->getRole());
191191

192192
.. note::
193193

components/translation/custom_formats.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Once created, it can be used as any other loader::
6363

6464
$translator->addResource('my_format', __DIR__.'/translations/messages.txt', 'fr_FR');
6565

66-
dump($translator->trans('welcome'));
66+
var_dump($translator->trans('welcome'));
6767

6868
It will print *"accueil"*.
6969

components/translation/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Imagine you want to translate the string *"Symfony is great"* into French::
1515
'Symfony is great!' => 'J\'aime Symfony!',
1616
), 'fr_FR');
1717

18-
dump($translator->trans('Symfony is great!'));
18+
var_dump($translator->trans('Symfony is great!'));
1919

2020
In this example, the message *"Symfony is great!"* will be translated into
2121
the locale set in the constructor (``fr_FR``) if the message exists in one of
@@ -31,7 +31,7 @@ Sometimes, a message containing a variable needs to be translated::
3131
// ...
3232
$translated = $translator->trans('Hello '.$name);
3333

34-
dump($translated);
34+
var_dump($translated);
3535

3636
However, creating a translation for this string is impossible since the translator
3737
will try to look up the exact message, including the variable portions
@@ -45,7 +45,7 @@ variable with a "placeholder"::
4545
array('%name%' => $name)
4646
);
4747

48-
dump($translated);
48+
var_dump($translated);
4949

5050
Symfony will now look for a translation of the raw message (``Hello %name%``)
5151
and *then* replace the placeholders with their values. Creating a translation

0 commit comments

Comments
 (0)