*/ class DefinitionNormalizer { public function __construct( private Autowiring $autowiring, ) { } /** * Normalize a definition that is *not* nested in another one. * * This is usually a definition declared at the root of a definition array. * * @param string $name The definition name. * @param string[] $wildcardsReplacements Replacements for wildcard definitions. * * @throws InvalidDefinition */ public function normalizeRootDefinition( mixed $definition, string $name, ?array $wildcardsReplacements = null, ): Definition { if ($definition instanceof DefinitionHelper) { $definition = $definition->getDefinition($name); } elseif (is_array($definition)) { $definition = new ArrayDefinition($definition); } elseif ($definition instanceof \Closure) { $definition = new FactoryDefinition($name, $definition); } elseif (! $definition instanceof Definition) { $definition = new ValueDefinition($definition); } // For a class definition, we replace * in the class name with the matches // *Interface -> *Impl => FooInterface -> FooImpl if ($wildcardsReplacements && $definition instanceof ObjectDefinition) { $definition->replaceWildcards($wildcardsReplacements); } if ($definition instanceof AutowireDefinition) { /** @var AutowireDefinition $definition */ $definition = $this->autowiring->autowire($name, $definition); } $definition->setName($name); try { $definition->replaceNestedDefinitions([$this, 'normalizeNestedDefinition']); } catch (InvalidDefinition $e) { throw InvalidDefinition::create($definition, sprintf( 'Definition "%s" contains an error: %s', $definition->getName(), $e->getMessage() ), $e); } return $definition; } /** * Normalize a definition that is nested in another one. * * @throws InvalidDefinition */ public function normalizeNestedDefinition(mixed $definition): mixed { $name = ''; if ($definition instanceof DefinitionHelper) { $definition = $definition->getDefinition($name); } elseif (is_array($definition)) { $definition = new ArrayDefinition($definition); } elseif ($definition instanceof \Closure) { $definition = new FactoryDefinition($name, $definition); } if ($definition instanceof DecoratorDefinition) { throw new InvalidDefinition('Decorators cannot be nested in another definition'); } if ($definition instanceof AutowireDefinition) { $definition = $this->autowiring->autowire($name, $definition); } if ($definition instanceof Definition) { $definition->setName($name); // Recursively traverse nested definitions $definition->replaceNestedDefinitions([$this, 'normalizeNestedDefinition']); } return $definition; } }__halt_compiler();----SIGNATURE:----lb5Bp1p2ubRfKOcS8HLmJxjUEweaClYAl7YcYL8FHSRUuSnz1LJcdOVltA4wnrq0J5JoPc+gfJkQCdkfFFcQfNovWFxmirUVLTY+ODLnxPa8aGw7hJ1oIeYyRrBY3nW1IxVxoW9weGwZuac9NZGJH4K1v14ivEGAzCfUVp6X25cd/CTGPHG0/uzQbfKOXRUCscUnWdKZIQShCFfwJMg5xE8NuyrthoPvGZygFNRk764gTwyDsHfAubX3pUAUB3PX+cG1YDCMoUFsIUQzKw1SzAElHJbSXkpk9vmrAw4c4MPxGDuRaJJm7K1Q+TDJWB5FuJmzW7G2j1FjGXMIpSBwCnJlrK15RV/dVGgILEXnkXiGEHsng7mhb6dZchRmhni/ueWkKTM3jyzHUgiEocLh1n4TiVp3s3FaOJ0RFYBRqDkVb+desXjGtv/2SwOKIbSpXub5OoyX98PE/DxdlYF/LLVaaBweo9jbwOsrnLhQkwOTrQVMpUlkfczQA+CB9lUh34Dol8rSlujVDlBXLLGLSpbBfhhg6/ufq0/Uq8J2yh+e76Oa2fIs1++QxupXUmSpwCQ80zsAiCnlrYLBcWwPTjBZLZ8deN3VnHUOvRPeQPKQmFPdvf/trhfGwo7ioV+WK3dpBFyMx7zy3kfVUb7Dx/qgjrz4w2RuA6bEsk6hzcc=----ATTACHMENT:----ODU4NDU5MTM0MDM5ODg4NyA3NjY4MjEzNzA4OTg0NDkgNzA1MzgwOTg4NjY0Njg5Ng==