BooleanNodeDefinition.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. /**
  13. * This class provides a fluent interface for defining a node.
  14. *
  15. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16. */
  17. class BooleanNodeDefinition extends ScalarNodeDefinition
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function __construct($name, NodeParentInterface $parent = null)
  23. {
  24. parent::__construct($name, $parent);
  25. $this->nullEquivalent = true;
  26. }
  27. /**
  28. * {@inheritdoc}
  29. *
  30. * @deprecated Deprecated since version 2.8, to be removed in 3.0.
  31. */
  32. public function cannotBeEmpty()
  33. {
  34. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35. return parent::cannotBeEmpty();
  36. }
  37. /**
  38. * Instantiate a Node.
  39. *
  40. * @return BooleanNode The node
  41. */
  42. protected function instantiateNode()
  43. {
  44. return new BooleanNode($this->name, $this->parent);
  45. }
  46. }