8000 Merge branch '5.1' into 5.2 · symfony/symfony@2b36487 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b36487

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: [DependencyInjection] Fixed incorrect report for private services if required service does not exist Remove Xdebug from php-extra runs.
2 parents 4b97b16 + 2d062df commit 2b36487

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ before_install:
5858
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
5959
export COMPOSER_UP='composer update --no-progress --ansi'
6060
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
61-
find ~/.phpenv -name xdebug.ini -delete
6261
6362
nanoseconds () {
6463
local cmd="date"
@@ -137,6 +136,7 @@ before_install:
137136
echo extension = memcached.so >> $INI
138137
fi
139138
done
139+
find ~/.phpenv -name xdebug.ini -delete
140140
141141
- |
142142
# Install extra PHP extensions

src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ public function __construct()
7979
new ReplaceAliasByActualDefinitionPass(),
8080
new RemoveAbstractDefinitionsPass(),
8181
new RemoveUnusedDefinitionsPass(),
82+
new AnalyzeServiceReferencesPass(),
83+
new CheckExceptionOnInvalidReferenceBehaviorPass(),
8284
new InlineServiceDefinitionsPass(new AnalyzeServiceReferencesPass()),
8385
new AnalyzeServiceReferencesPass(),
8486
new DefinitionErrorExceptionPass(),
8587
]];
8688

8789
$this->afterRemovingPasses = [[
88-
new CheckExceptionOnInvalidReferenceBehaviorPass(),
8990
new ResolveHotPathPass(),
9091
new ResolveNoPreloadPass(),
9192
new AliasDeprecatedPublicServicesPass(),

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,47 @@ public function testNoClassFromNsSeparatorId()
13371337
$container->compile();
13381338
}
13391339

1340+
public function testGetThrownServiceNotFoundExceptionWithCorrectServiceId()
1341+
{
1342+
$this->expectException(ServiceNotFoundException::class);
1343+
$this->expectExceptionMessage('The service "child_service" has a dependency on a non-existent service "non_existent_service".');
1344+
1345+
$container = new ContainerBuilder();
1346+
$container->register('child_service', \stdClass::class)
1347+
->setPublic(false)
1348+
->addArgument([
1349+
'non_existent' => new Reference('non_existent_service'),
1350+
])
1351+
;
1352+
$container->register('parent_service', \stdClass::class)
1353+
->setPublic(true)
1354+
->addArgument([
1355+
'child_service' => new Reference('child_service'),
1356+
])
1357+
;
1358+
1359+
$container->compile();
1360+
}
1361+
1362+
public function testUnusedServiceRemovedByPassAndServiceNotFoundExceptionWasNotThrown()
1363+
{
1364+
$container = new ContainerBuilder();
1365+
$container->register('service', \stdClass::class)
1366+
->setPublic(false)
1367+
->addArgument([
1368+
'non_existent_service' => new Reference('non_existent_service'),
1369+
])
1370+
;
1371+
1372+
try {
1373+
$container->compile();
1374+
} catch (ServiceNotFoundException $e) {
1375+
$this->fail('Should not be thrown');
1376+
}
1377+
1378+
$this->addToAssertionCount(1);
1379+
}
1380+
13401381
public function testServiceLocator()
13411382
{
13421383
$container = new ContainerBuilder();

0 commit comments

Comments
 (0)
0