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

Skip to content

Commit 2d062df

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

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
@@ -85,13 +85,14 @@ public function __construct()
8585
new ReplaceAliasByActualDefinitionPass(),
8686
new RemoveAbstractDefinitionsPass(),
8787
new RemoveUnusedDefinitionsPass(),
88+
new AnalyzeServiceReferencesPass(),
89+
new CheckExceptionOnInvalidReferenceBehaviorPass(),
8890
new InlineServiceDefinitionsPass(new AnalyzeServiceReferencesPass()),
8991
new AnalyzeServiceReferencesPass(),
9092
new DefinitionErrorExceptionPass(),
9193
]];
9294

9395
$this->afterRemovingPasses = [[
94-
new CheckExceptionOnInvalidReferenceBehaviorPass(),
9596
new ResolveHotPathPass(),
9697
new ResolveNoPreloadPass(),
9798
new AliasDeprecatedPublicServicesPass(),

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

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

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

0 commit comments

Comments
 (0)
0