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 scalar value in the config tree.
19 * The following values are considered scalars:
26 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
28 class ScalarNode extends VariableNode
33 protected function validateType($value)
35 if (!is_scalar($value) && null !== $value) {
36 $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected scalar, but got %s.', $this->getPath(), \gettype($value)));
37 if ($hint = $this->getInfo()) {
40 $ex->setPath($this->getPath());
49 protected function isValueEmpty($value)
51 return null === $value || '' === $value;