[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits; 13 14 use Symfony\Component\DependencyInjection\ChildDefinition; 15 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; 16 17 /** 18 * @method $this parent(string $parent) 19 */ 20 trait ParentTrait 21 { 22 /** 23 * Sets the Definition to inherit from. 24 * 25 * @param string $parent 26 * 27 * @return $this 28 * 29 * @throws InvalidArgumentException when parent cannot be set 30 */ 31 final protected function setParent($parent) 32 { 33 if (!$this->allowParent) { 34 throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id)); 35 } 36 37 if ($this->definition instanceof ChildDefinition) { 38 $this->definition->setParent($parent); 39 } elseif ($this->definition->isAutoconfigured()) { 40 throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); 41 } elseif ($this->definition->getBindings()) { 42 throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also "bind" arguments.', $this->id)); 43 } else { 44 // cast Definition to ChildDefinition 45 $definition = serialize($this->definition); 46 $definition = substr_replace($definition, '53', 2, 2); 47 $definition = substr_replace($definition, 'Child', 44, 0); 48 $definition = unserialize($definition); 49 50 $this->definition = $definition->setParent($parent); 51 } 52 53 return $this; 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |