4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Config\Definition\Builder;
15 * This class builds validation conditions.
17 * @author Christophe Coevoet <stof@notk.org>
19 class ValidationBuilder
22 public $rules = array();
24 public function __construct(NodeDefinition $node)
30 * Registers a closure to run as normalization or an expression builder to build it if null is provided.
32 * @return ExprBuilder|$this
34 public function rule(\Closure $closure = null)
36 if (null !== $closure) {
37 $this->rules[] = $closure;
42 return $this->rules[] = new ExprBuilder($this->node);