コード例 #1
0
 protected function validatePrototypeNode(PrototypedArrayNode $node)
 {
     $path = $node->getPath();
     if ($this->addDefaults) {
         throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path));
     }
     if (false !== $this->addDefaultChildren) {
         if ($this->default) {
             throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path));
         }
         if (null !== $this->key && (null === $this->addDefaultChildren || is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) {
             throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path));
         }
         if (null === $this->key && (is_string($this->addDefaultChildren) || is_array($this->addDefaultChildren))) {
             throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path));
         }
     }
 }