From 27e2ec139d7dc2b767d85671e11a51ac06e11e5c Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 15 Feb 2011 15:08:32 +0100 Subject: [PATCH] Added the possibility to add the value in the exception message --- .../DependencyInjection/Configuration/Builder/ExprBuilder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php b/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php index 8c1fec1f21..b0c9f0adfd 100644 --- a/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php +++ b/src/Symfony/Component/DependencyInjection/Configuration/Builder/ExprBuilder.php @@ -157,13 +157,15 @@ class ExprBuilder /** * Sets a closure marking the value as invalid at validation time. * + * if you want to add the value of the node in your message just use a %s placeholder. + * * @param string $message * * @return Symfony\Component\DependencyInjection\Configuration\Builder\ExprBuilder */ public function thenInvalid($message) { - $this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException($message); }; + $this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, $v)); }; return $this; }