Skip to content

[FrameworkBundle] fix lint:container command #60942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2025

Conversation

santysisi
Copy link
Contributor

@santysisi santysisi commented Jun 28, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #60920
License MIT

This PR resolves two issues related to the lint:container command:

  1. Incorrect use of isDebug() method: The isDebug() method was being called on the $container, but this method does not exist there. The correct call should be on the $kernel instance.

  2. Issue during container unserialization: When unserializing the dumped container to retrieve the ContainerBuilder, problem was with the service aliases. The public property was not correctly initialized because the constructor is bypassed during unserialization.

@carsonbot carsonbot added this to the 7.4 milestone Jun 28, 2025
@santysisi santysisi force-pushed the fix/lint-container-command branch from 5018fdd to e191359 Compare June 28, 2025 21:29
@santysisi santysisi changed the title [Command] fix lint:container command [FrameworkBundle] fix lint:container command Jun 28, 2025
@santysisi
Copy link
Contributor Author

status: needs work

@carsonbot carsonbot changed the title [FrameworkBundle] fix lint:container command fix lint:container command Jun 28, 2025
@santysisi santysisi force-pushed the fix/lint-container-command branch from e191359 to 0196be5 Compare June 29, 2025 00:30
@santysisi
Copy link
Contributor Author

status: needs review

Comment on lines +20 to +27
private bool $public = false;
private array $deprecation = [];

public function __construct(
private string $id,
private bool $public = false,
bool $public = false,
) {
$this->public = $public;
Copy link
Contributor Author

@santysisi santysisi Jun 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to avoid changing the __constructor, we can use the magic __unserialize method instead:

public function __unserialize(array $data): void
{
    $this->id = $data['id'];
    $this->public = $data['public'] ?? false;
    $this->deprecation = $data['deprecation'] ?? [];
}

@santysisi santysisi changed the title fix lint:container command [FrameworkBundle] fix lint:container command Jun 29, 2025
@santysisi
Copy link
Contributor Author

I'll try to add some tests as soon as possible.

@nicolas-grekas
Copy link
Member

Thank you @santysisi.

@nicolas-grekas nicolas-grekas merged commit 3448023 into symfony:7.4 Jun 29, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FrameworkBundle] Can't use container:lint command
3 participants