Skip to content

[DependencyInjection] Fix ternary in AutowireCallable attribute #57310

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

Conversation

alamirault
Copy link
Contributor

@alamirault alamirault commented Jun 4, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

Although AutowireCallable construct is

    public function __construct(
        ...
        bool|string $lazy = false,
    ) {

It call Autowire::__construct(..., lazy: $lazy);

And in this class construct is

    public function __construct(
        ...
        bool|string|array $lazy = false,
    ) {
        if ($this->lazy = \is_string($lazy) ? [$lazy] : $lazy) {}
    }

So $this->lazy is always bool|array and ternary always false

@alamirault alamirault changed the title [DependencyInjection] Remove unnecessary ternary in AutowireCallable attribute [DependencyInjection] Fix ternary in AutowireCallable attribute Jun 6, 2024
@alamirault alamirault force-pushed the feature-di-remove-ternary-autowire-callable branch from 46ddb5b to f4792bc Compare June 13, 2024 17:56
@alamirault alamirault changed the base branch from 7.2 to 6.4 June 13, 2024 17:56
@nicolas-grekas
Copy link
Member

Up for a test case? :)

@fabpot
Copy link
Member

fabpot commented Jun 15, 2024

Thank you @alamirault.

@fabpot fabpot merged commit e3b80f3 into symfony:6.4 Jun 15, 2024
8 of 10 checks passed
@alamirault alamirault deleted the feature-di-remove-ternary-autowire-callable branch June 18, 2024 17:34
nicolas-grekas added a commit that referenced this pull request Jun 24, 2024
…lable::buildDefinition()` (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[DependencyInjection] Add test coverage for `AutowireCallable::buildDefinition()`

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Add tests for #57310

Commits
-------

55d2703 [DependencyInjection] Add test coverage for `AutowireCallable::buildDefinition()`
This was referenced Jun 28, 2024
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.

4 participants