From bfd1584a67a28c075dc7c3ac5722b5e5daf0c730 Mon Sep 17 00:00:00 2001 From: Andrew M Date: Tue, 21 Jan 2014 22:37:49 +0200 Subject: [PATCH] Minimize horizontal scrolling in code blocks (improve readability) --- cookbook/templating/PHP.rst | 5 ++++- cookbook/validation/custom_constraint.rst | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cookbook/templating/PHP.rst b/cookbook/templating/PHP.rst index bd3dba7ff26..e3f3a4fb30b 100644 --- a/cookbook/templating/PHP.rst +++ b/cookbook/templating/PHP.rst @@ -54,7 +54,10 @@ below renders the ``index.html.php`` template:: // ... public function indexAction($name) { - return $this->render('AcmeHelloBundle:Hello:index.html.php', array('name' => $name)); + return $this->render( + 'AcmeHelloBundle:Hello:index.html.php', + array('name' => $name) + ); } You can also use the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/view` diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index c8494cdfbc4..4bdffc45e0c 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -65,7 +65,10 @@ The validator class is also simple, and only has one required method ``validate( public function validate($value, Constraint $constraint) { if (!preg_match('/^[a-zA-Za0-9]+$/', $value, $matches)) { - $this->context->addViolation($constraint->message, array('%string%' => $value)); + $this->context->addViolation( + $constraint->message, + array('%string%' => $value) + ); } } } @@ -216,7 +219,12 @@ With this, the validator ``validate()`` method gets an object as its first argum public function validate($protocol, Constraint $constraint) { if ($protocol->getFoo() != $protocol->getBar()) { - $this->context->addViolationAt('foo', $constraint->message, array(), null); + $this->context->addViolationAt( + 'foo', + $constraint->message, + array(), + null + ); } } }