bug #22399 [2.8] Prevent double registrations related to tag priorities (nicolas-grekas)
This PR was merged into the 2.8 branch.
Discussion
----------
[2.8] Prevent double registrations related to tag priorities
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
#22396 on 2.8
Commits
-------
2be5821743
[2.8] Prevent double registrations related to tag priorities
This commit is contained in:
commit
d564c6ad7d
@ -57,12 +57,10 @@ class PropertyInfoPass implements CompilerPassInterface
|
|||||||
$services = $container->findTaggedServiceIds($tagName);
|
$services = $container->findTaggedServiceIds($tagName);
|
||||||
|
|
||||||
$sortedServices = array();
|
$sortedServices = array();
|
||||||
foreach ($services as $serviceId => $tags) {
|
foreach ($services as $serviceId => $attributes) {
|
||||||
foreach ($tags as $attributes) {
|
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
|
||||||
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
|
|
||||||
$sortedServices[$priority][] = new Reference($serviceId);
|
$sortedServices[$priority][] = new Reference($serviceId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($sortedServices)) {
|
if (empty($sortedServices)) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -20,9 +20,9 @@ class PropertyInfoPassTest extends TestCase
|
|||||||
public function testServicesAreOrderedAccordingToPriority()
|
public function testServicesAreOrderedAccordingToPriority()
|
||||||
{
|
{
|
||||||
$services = array(
|
$services = array(
|
||||||
'n3' => array('tag' => array()),
|
'n3' => array(array()),
|
||||||
'n1' => array('tag' => array('priority' => 200)),
|
'n1' => array(array('priority' => 200)),
|
||||||
'n2' => array('tag' => array('priority' => 100)),
|
'n2' => array(array('priority' => 100)),
|
||||||
);
|
);
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
Reference in New Issue
Block a user