Skip to content

Commit

Permalink
5177 use dump() instead of echo in examples
Browse files Browse the repository at this point in the history
Conflicts:
	book/doctrine.rst
	components/event_dispatcher/introduction.rst
	components/serializer.rst
  • Loading branch information
Henry Snoek authored and wouterj committed Jun 27, 2015
1 parent 52bd0a9 commit 00a522b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions components/expression_language/caching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and
// the parse() method returns a ParsedExpression
$expression = $language->parse('1 + 4', array());

echo $language->evaluate($expression); // prints 5
dump($language->evaluate($expression)); // prints 5

.. code-block:: php
Expand All @@ -68,7 +68,7 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and
serialize($language->parse('1 + 4', array()))
);
echo $language->evaluate($expression); // prints 5
dump($language->evaluate($expression)); // prints 5
.. _DoctrineBridge: https://github.com/symfony/DoctrineBridge
.. _`doctrine cache library`: http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html
3 changes: 2 additions & 1 deletion components/expression_language/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This method has 3 arguments:
return strtolower($str);
});
echo $language->evaluate('lowercase("HELLO")');
dump($language->evaluate('lowercase("HELLO")'));
This will print ``hello``. Both the **compiler** and **evaluator** are passed
an ``arguments`` variable as their first argument, which is equal to the
Expand Down Expand Up @@ -126,3 +126,4 @@ or by using the second argument of the constructor::
parent::__construct($parser, $providers);
}
}

8 changes: 4 additions & 4 deletions components/expression_language/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ The main class of the component is

$language = new ExpressionLanguage();

echo $language->evaluate('1 + 2'); // displays 3
dump($language->evaluate('1 + 2')); // displays 3

echo $language->compile('1 + 2'); // displays (1 + 2)
dump($language->compile('1 + 2')); // displays (1 + 2)

Expression Syntax
-----------------
Expand All @@ -96,12 +96,12 @@ PHP type (including objects)::
$apple = new Apple();
$apple->variety = 'Honeycrisp';

echo $language->evaluate(
dump($language->evaluate(
'fruit.variety',
array(
'fruit' => $apple,
)
);
));

This will print "Honeycrisp". For more information, see the :doc:`/components/expression_language/syntax`
entry, especially :ref:`component-expression-objects` and :ref:`component-expression-arrays`.
Expand Down
24 changes: 12 additions & 12 deletions components/expression_language/syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ to JavaScript::
$apple = new Apple();
$apple->variety = 'Honeycrisp';

echo $language->evaluate(
dump($language->evaluate(
'fruit.variety',
array(
'fruit' => $apple,
)
);
));

This will print out ``Honeycrisp``.

Expand All @@ -72,12 +72,12 @@ JavaScript::

$robot = new Robot();

echo $language->evaluate(
dump($language->evaluate(
'robot.sayHi(3)',
array(
'robot' => $robot,
)
);
));

This will print out ``Hi Hi Hi!``.

Expand All @@ -93,9 +93,9 @@ constant::

define('DB_USER', 'root');

echo $language->evaluate(
dump($language->evaluate(
'constant("DB_USER")'
);
));

This will print out ``root``.

Expand All @@ -114,12 +114,12 @@ array keys, similar to JavaScript::

$data = array('life' => 10, 'universe' => 10, 'everything' => 22);

echo $language->evaluate(
dump($language->evaluate(
'data["life"] + data["universe"] + data["everything"]',
array(
'data' => $data,
)
);
));

This will print out ``42``.

Expand All @@ -140,14 +140,14 @@ Arithmetic Operators

For example::

echo $language->evaluate(
dump($language->evaluate(
'life + universe + everything',
array(
'life' => 10,
'universe' => 10,
'everything' => 22,
)
);
));

This will print out ``42``.

Expand Down Expand Up @@ -230,13 +230,13 @@ String Operators

For example::

echo $language->evaluate(
dump($language->evaluate(
'firstName~" "~lastName',
array(
'firstName' => 'Arthur',
'lastName' => 'Dent',
)
);
));

This would print out ``Arthur Dent``.

Expand Down
2 changes: 1 addition & 1 deletion components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ having unique identifiers::
});

$serializer = new Serializer(array($normalizer), array($encoder));
echo $serializer->serialize($org, 'json');
dump($serializer->serialize($org, 'json'));
// {"name":"Les-Tilleuls.coop","members":[{"name":"K\u00e9vin", organization: "Les-Tilleuls.coop"}]}

JMSSerializer
Expand Down

0 comments on commit 00a522b

Please sign in to comment.