vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php line 27

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Config\Definition\Builder;
  11. use Symfony\Component\Config\Definition\BooleanNode;
  12. use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;
  13. /**
  14.  * This class provides a fluent interface for defining a node.
  15.  *
  16.  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  17.  */
  18. class BooleanNodeDefinition extends ScalarNodeDefinition
  19. {
  20.     /**
  21.      * {@inheritdoc}
  22.      */
  23.     public function __construct(?string $nameNodeParentInterface $parent null)
  24.     {
  25.         parent::__construct($name$parent);
  26.         $this->nullEquivalent true;
  27.     }
  28.     /**
  29.      * Instantiate a Node.
  30.      *
  31.      * @return BooleanNode
  32.      */
  33.     protected function instantiateNode()
  34.     {
  35.         return new BooleanNode($this->name$this->parent$this->pathSeparator);
  36.     }
  37.     /**
  38.      * {@inheritdoc}
  39.      *
  40.      * @throws InvalidDefinitionException
  41.      */
  42.     public function cannotBeEmpty()
  43.     {
  44.         throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.');
  45.     }
  46. }