Skip to content

Commit 78c9b7c

Browse files
Henry Snoekwouterj
Henry Snoek
authored andcommitted
5177 use dump() instead of print in examples
1 parent 10898c9 commit 78c9b7c

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

components/class_loader/class_map_generator.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ method::
5050

5151
use Symfony\Component\ClassLoader\ClassMapGenerator;
5252

53-
print_r(ClassMapGenerator::createMap(__DIR__.'/library'));
53+
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ equivalents::
5151

5252
use Symfony\Component\CssSelector\CssSelector;
5353

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

5656
This gives the following output:
5757

components/dom_crawler.rst

+1-1
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-
print $domElement->nodeName;
50+
dump($domElement->nodeName);
5151
}
5252

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

components/finder.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ directories::
3030
$finder->files()->in(__DIR__);
3131

3232
foreach ($finder as $file) {
33-
// Print the absolute path
34-
print $file->getRealpath()."\n";
33+
// Dump the absolute path
34+
dump($file->getRealpath());
3535

36-
// Print the relative path to the file, omitting the filename
37-
print $file->getRelativePath()."\n";
36+
// Dump the relative path to the file, omitting the filename
37+
dump($file->getRelativePath());
3838

39-
// Print the relative path to the file
40-
print $file->getRelativePathname()."\n";
39+
// Dump the relative path to the file
40+
dump($file->getRelativePathname());
4141
}
4242

4343
The ``$file`` is an instance of :class:`Symfony\\Component\\Finder\\SplFileInfo`
@@ -121,9 +121,7 @@ And it also works with user-defined streams::
121121
$finder = new Finder();
122122
$finder->name('photos*')->size('< 100K')->date('since 1 hour ago');
123123
foreach ($finder->in('s3://bucket-name') as $file) {
124-
// ... do something
125-
126-
print $file->getFilename()."\n";
124+
// ... do something with the file
127125
}
128126

129127
.. note::

0 commit comments

Comments
 (0)