-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #57298 [DependencyInjection] Fix handling of repeated `#[Autoconf…
…igure]` attributes (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Fix handling of repeated `#[Autoconfigure]` attributes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #56841 | License | MIT When repeating `#[Autoconfigure]`, arguments from all attributes are now used. If an option is defined multiple times in repeated attributes, the last attribute defined will sets value. Commits ------- e9de5a0b95 [DependencyInjection] Add tests for repeating `#[Autoconfigure]` attributes 7399a898cd [DependencyInjection] Fix handling of repeated `#[Autoconfigure]` attributes
- Loading branch information
Showing
8 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; | ||
|
||
#[Autoconfigure(public: true, shared: false)] | ||
#[Autoconfigure(lazy: true)] | ||
class AutoconfigureRepeated | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; | ||
|
||
#[Autoconfigure(bind: ['$arg' => 'foo'])] | ||
#[Autoconfigure(bind: ['$arg' => 'bar'])] | ||
class AutoconfigureRepeatedBindings | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; | ||
|
||
#[Autoconfigure(calls: [['setBar', ['arg2']]])] | ||
#[Autoconfigure(calls: [['setFoo', ['arg1']]])] | ||
class AutoconfigureRepeatedCalls | ||
{ | ||
public function setFoo(string $arg) | ||
{ | ||
} | ||
|
||
public function setBar(string $arg) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; | ||
|
||
#[Autoconfigure(public: true, shared: false)] | ||
#[Autoconfigure(lazy: true, shared: true, public: false)] | ||
class AutoconfigureRepeatedOverwrite | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure; | ||
|
||
#[Autoconfigure(properties: ['$replaced' => 'to be replaced', '$bar' => 'existing to be replaced'])] | ||
#[Autoconfigure(properties: ['$foo' => 'bar', '$bar' => 'baz'])] | ||
class AutoconfigureRepeatedProperties | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; | ||
|
||
#[AutoconfigureTag('foo', ['priority' => 2])] | ||
#[AutoconfigureTag('bar')] | ||
class AutoconfigureRepeatedTag | ||
{ | ||
} |