Skip to content

Commit b4aea88

Browse files
committed
Merge branch '4.2'
* 4.2: (45 commits) [Form] various minor fixes Ensure the parent process is always killed bugfix: the terminal state was wrong and not reseted [Console] Fix inconsistent result for choice questions in non-interactive mode Define null return type for Constraint::getDefaultOption() [Routing] Fix: annotation loader ignores method's default values [HttpKernel] Fix DebugHandlersListener constructor docblock Skip Glob brace test when GLOB_BRACE is unavailable bumped Symfony version to 4.2.6 updated VERSION for 4.2.5 updated CHANGELOG for 4.2.5 bumped Symfony version to 3.4.25 updated VERSION for 3.4.24 update CONTRIBUTORS for 3.4.24 updated CHANGELOG for 3.4.24 [EventDispatcher] cleanup fix testIgnoredAttributesInContext Re-generate icu 64.1 data Improve PHPdoc / IDE autocomplete for config tree builder [Bridge][Twig] DebugCommand - fix escaping and filter ...
2 parents c5fd454 + 1806e43 commit b4aea88

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

Dumper/XmlDumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent
306306
} elseif ($value instanceof Reference) {
307307
$element->setAttribute('type', 'service');
308308
$element->setAttribute('id', (string) $value);
309-
$behaviour = $value->getInvalidBehavior();
310-
if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behaviour) {
309+
$behavior = $value->getInvalidBehavior();
310+
if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) {
311311
$element->setAttribute('on-invalid', 'null');
312-
} elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behaviour) {
312+
} elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) {
313313
$element->setAttribute('on-invalid', 'ignore');
314-
} elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behaviour) {
314+
} elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) {
315315
$element->setAttribute('on-invalid', 'ignore_uninitialized');
316316
}
317317
} elseif ($value instanceof Definition) {

Tests/Fixtures/BarFactory.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
4+
5+
class BarFactory
6+
{
7+
/**
8+
* @var iterable
9+
*/
10+
private $bars;
11+
12+
public function __construct(iterable $bars)
13+
{
14+
$this->bars = \iterator_to_array($bars);
15+
}
16+
17+
public function getDefaultBar(): BarInterface
18+
{
19+
return reset($this->bars);
20+
}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
_instanceof:
3+
Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface:
4+
tags:
5+
- { name: bar }
6+
7+
Symfony\Component\DependencyInjection\Tests\Fixtures\Bar:
8+
public: true
9+
10+
Symfony\Component\DependencyInjection\Tests\Fixtures\BarFactory:
11+
arguments: [!tagged 'bar']
12+
13+
Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface:
14+
factory: ['@Symfony\Component\DependencyInjection\Tests\Fixtures\BarFactory', 'getDefaultBar']

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,4 +812,15 @@ public function testFqcnLazyProxy()
812812
$definition = $container->getDefinition('foo');
813813
$this->assertSame([['interface' => 'SomeInterface']], $definition->getTag('proxy'));
814814
}
815+
816+
public function testServiceWithSameNameAsInterfaceAndFactoryIsNotTagged()
817+
{
818+
$container = new ContainerBuilder();
819+
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
820+
$loader->load('service_instanceof_factory.yml');
821+
$container->compile();
822+
823+
$tagged = $container->findTaggedServiceIds('bar');
824+
$this->assertCount(1, $tagged);
825+
}
815826
}

0 commit comments

Comments
 (0)