src/DI/ConsoleExtension.php
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		// Skip if isn't CLI
		if ($this->cliMode !== true) return;

		Validators::assertField($config, 'helpers', 'array|null');

		$application = $builder->addDefinition($this->prefix('application'))
			->setFactory(Application::class);

		if ($config['name'] !== null) {
			$application->addSetup('setName', [$config['name']]);
		}

		if ($config['version'] !== null) {
			$application->addSetup('setVersion', [$config['version']]);
		}

		if ($config['catchExceptions'] !== null) {
			$application->addSetup('setCatchExceptions', [(bool) $config['catchExceptions']]);
		}

		if ($config['autoExit'] !== null) {
			$application->addSetup('setAutoExit', [(bool) $config['autoExit']]);
		}

		if ($config['helperSet'] !== null) {
			if (is_string($config['helperSet']) && Strings::startsWith($config['helperSet'], '@')) {
				// Add already defined service
				$application->addSetup('setHelperSet', [$config['helperSet']]);
			} else {
				// Parse service definition
				$helperSetDef = $builder->addDefinition($this->prefix('helperSet'));
				Compiler::loadDefinition($helperSetDef, $config['helperSet']);
				$application->addSetup('setHelperSet', [$helperSetDef]);
			}
		}

		if (is_array($config['helpers'])) {
			$helpers = 1;
			foreach ($config['helpers'] as $helper) {
				$helperDef = $builder->addDefinition($this->prefix('helper.' . $helpers++));
				Compiler::loadDefinition($helperDef, $helper);
				$application->addSetup(new Statement('$service->getHelperSet()->set(?)', [$helperDef]));
			}
		}

		if ($config['lazy'] === true) {
			$builder->addDefinition($this->prefix('commandLoader'))
				->setType(CommandLoaderInterface::class)
				->setFactory(ContainerCommandLoader::class);

			$application->addSetup('setCommandLoader', ['@' . $this->prefix('commandLoader')]);
		}
	}
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);

		// Skip if isn't CLI
		if ($this->cliMode !== true) return;

		Validators::assertField($config, 'helpers', 'array|null');

		$application = $builder->addDefinition($this->prefix('application'))
			->setFactory(Application::class);

		if ($config['name'] !== null) {
			$application->addSetup('setName', [$config['name']]);
		}

		if ($config['version'] !== null) {
			$application->addSetup('setVersion', [$config['version']]);
		}

		if ($config['catchExceptions'] !== null) {
			$application->addSetup('setCatchExceptions', [(bool) $config['catchExceptions']]);
		}

		if ($config['autoExit'] !== null) {
			$application->addSetup('setAutoExit', [(bool) $config['autoExit']]);
		}

		if ($config['helperSet'] !== null) {
			if (is_string($config['helperSet']) && Strings::startsWith($config['helperSet'], '@')) {
				// Add already defined service
				$application->addSetup('setHelperSet', [$config['helperSet']]);
			} else {
				// Parse service definition
				$helperSetDef = $builder->addDefinition($this->prefix('helperSet'));
				Compiler::loadDefinition($helperSetDef, $config['helperSet']);
				$application->addSetup('setHelperSet', [$helperSetDef]);
			}
		}

		if (is_array($config['helpers'])) {
			$helpers = 1;
			foreach ($config['helpers'] as $helper) {
				$helperDef = $builder->addDefinition($this->prefix('helper.' . $helpers++));
				Compiler::loadDefinition($helperDef, $helper);
				$application->addSetup(new Statement('$service->getHelperSet()->set(?)', [$helperDef]));
			}
		}

		if ($config['lazy'] === true) {
			$builder->addDefinition($this->prefix('commandLoader'))
				->setType(CommandLoaderInterface::class)
				->setFactory(ContainerCommandLoader::class);

			$application->addSetup('setCommandLoader', ['@' . $this->prefix('commandLoader')]);
		}
	}
Register services