Skip to content

Fix uninitialized typed $container error on Symfony Console 8.1#119

Merged
kayw-geek merged 1 commit into
symplify:mainfrom
kayw-geek:fix/symfony-console-8.1-container-init
May 20, 2026
Merged

Fix uninitialized typed $container error on Symfony Console 8.1#119
kayw-geek merged 1 commit into
symplify:mainfrom
kayw-geek:fix/symfony-console-8.1-container-init

Conversation

@kayw-geek

@kayw-geek kayw-geek commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

MonorepoBuilderApplication::__construct calls $this->addCommands($commands) before parent::__construct(). Symfony Console 8.1 promoted $container to a typed constructor-promoted property on Application, and the addCommand()init()registerContainerServices() path reads $this->container. Reading an uninitialized typed property fatals:

Typed property Symfony\Component\Console\Application::$container must not be accessed before initialization

Calling parent::__construct() first resolves it. Always-correct pattern; the old order only happened to work because the parent didn't access a typed property in that path before 8.1.

Fixes #118.

@kayw-geek kayw-geek enabled auto-merge (squash) May 20, 2026 01:27
@kayw-geek kayw-geek merged commit a5ae1ab into symplify:main May 20, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symfony Console 8.1: MonorepoBuilderApplication accesses uninitialized Application::$container

1 participant