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;
14 use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
17 * This node represents a float value in the config tree.
19 * @author Jeanmonod David <david.jeanmonod@gmail.com>
21 class FloatNode extends NumericNode
26 protected function validateType($value)
28 // Integers are also accepted, we just cast them
30 $value = (float) $value;
33 if (!is_float($value)) {
34 $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected float, but got %s.', $this->getPath(), gettype($value)));
35 if ($hint = $this->getInfo()) {
38 $ex->setPath($this->getPath());