Skip to content

Commit 6313164

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: fix SQLSRV throws for method_exists() [HttpKernel] Add basic support for language negotiation [Messenger] Add a middleware to log when transaction has been left open [HttpClient] Add method to set response factory in mock client Move array_merge calls out of loops to improve performance Remove references to DBALException [VarDumper] Fix handling of "new" in initializers on PHP 8.1
2 parents ddf7ad6 + f39e0c9 commit 6313164

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,10 +1211,10 @@ public function findTags(): array
12111211
{
12121212
$tags = [];
12131213
foreach ($this->getDefinitions() as $id => $definition) {
1214-
$tags = array_merge(array_keys($definition->getTags()), $tags);
1214+
$tags[] = array_keys($definition->getTags());
12151215
}
12161216

1217-
return array_unique($tags);
1217+
return array_unique(array_merge([], ...$tags));
12181218
}
12191219

12201220
/**

Dumper/GraphvizDumper.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,22 @@ private function findEdges(string $id, array $arguments, bool $required, string
128128
$lazyEdge = $lazy || $this->container->getDefinition((string) $argument)->isLazy();
129129
}
130130

131-
$edges[] = ['name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge];
131+
$edges[] = [['name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge]];
132132
} elseif ($argument instanceof ArgumentInterface) {
133-
$edges = array_merge($edges, $this->findEdges($id, $argument->getValues(), $required, $name, true));
133+
$edges[] = $this->findEdges($id, $argument->getValues(), $required, $name, true);
134134
} elseif ($argument instanceof Definition) {
135-
$edges = array_merge($edges,
136-
$this->findEdges($id, $argument->getArguments(), $required, ''),
137-
$this->findEdges($id, $argument->getProperties(), false, '')
138-
);
135+
$edges[] = $this->findEdges($id, $argument->getArguments(), $required, '');
136+
$edges[] = $this->findEdges($id, $argument->getProperties(), false, '');
137+
139138
foreach ($argument->getMethodCalls() as $call) {
140-
$edges = array_merge($edges, $this->findEdges($id, $call[1], false, $call[0].'()'));
139+
$edges[] = $this->findEdges($id, $call[1], false, $call[0].'()');
141140
}
142141
} elseif (\is_array($argument)) {
143-
$edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name, $lazy));
142+
$edges[] = $this->findEdges($id, $argument, $required, $name, $lazy);
144143
}
145144
}
146145

147-
return $edges;
146+
return array_merge([], ...$edges);
148147
}
149148

150149
private function findNodes(): array

Tests/ContainerBuilderTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,6 +1711,18 @@ public function testReferencingDeprecatedPublicService()
17111711

17121712
$this->addToAssertionCount(1);
17131713
}
1714+
1715+
public function testFindTags()
1716+
{
1717+
$container = new ContainerBuilder();
1718+
$container
1719+
->register(A::class)
1720+
->addTag('tag1')
1721+
->addTag('tag2')
1722+
->addTag('tag3');
1723+
1724+
$this->assertSame(['tag1', 'tag2', 'tag3'], $container->findTags());
1725+
}
17141726
}
17151727

17161728
class FooClass

0 commit comments

Comments
 (0)