Spaces:
Runtime error
Runtime error
Download symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php from Alcazard/vibe-coding-api: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/Alcazard/vibe-coding-api/resolve/main/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php
- Command line
-
hf download hf://spaces/Alcazard/vibe-coding-api/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php
-
curl -L -o ParentTrait.php https://huggingface.co/spaces/Alcazard/vibe-coding-api/resolve/main/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php
1.46 kB
| /* | |
| * This file is part of the Symfony package. | |
| * | |
| * (c) Fabien Potencier <fabien@symfony.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits; | |
| use Symfony\Component\DependencyInjection\ChildDefinition; | |
| use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | |
| trait ParentTrait | |
| { | |
| /** | |
| * Sets the Definition to inherit from. | |
| * | |
| * @return $this | |
| * | |
| * @throws InvalidArgumentException when parent cannot be set | |
| */ | |
| final public function parent(string $parent): static | |
| { | |
| if (!$this->allowParent) { | |
| throw new InvalidArgumentException(\sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id)); | |
| } | |
| if ($this->definition instanceof ChildDefinition) { | |
| $this->definition->setParent($parent); | |
| } else { | |
| // cast Definition to ChildDefinition | |
| $definition = serialize($this->definition); | |
| $definition = substr_replace($definition, '53', 2, 2); | |
| $definition = substr_replace($definition, 'Child', 44, 0); | |
| $definition = unserialize($definition); | |
| $this->definition = $definition->setParent($parent); | |
| } | |
| return $this; | |
| } | |
| } | |