Skip to content

Commit 20a87dd

Browse files
Merge branch '4.2'
* 4.2: fix cs [FrameworkBundle] define doctrine as default_pdo_provider only if the package is installed [Validator] Allow `ConstraintViolation::__toString()` to expose codes that are not null or emtpy strings Added upgrade to HandlersLocator fix type for $value in DocBlock [WebProfilerBundle] Fix title case [Config] fix path exclusion during glob discovery [FrameworkBundle][Messenger] Restore check for messenger serializer default id Fix wrapped loop of event listener [DI] fix edge case in InlineServiceDefinitionsPass undeprecate the single-colon notation for controllers Update HttpKernel.php
2 parents 823f07a + 4f02b8a commit 20a87dd

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ private function isInlineableDefinition($id, Definition $definition)
164164
return false;
165165
}
166166

167+
if (!$this->graph->hasNode($id)) {
168+
return true;
169+
}
170+
167171
if (!$definition->isShared()) {
168172
foreach ($this->graph->getNode($id)->getInEdges() as $edge) {
169173
$srcId = $edge->getSourceNode()->getId();
@@ -180,10 +184,6 @@ private function isInlineableDefinition($id, Definition $definition)
180184
return false;
181185
}
182186

183-
if (!$this->graph->hasNode($id)) {
184-
return true;
185-
}
186-
187187
if ($this->currentId == $id) {
188188
return false;
189189
}

Tests/Loader/FileLoaderTest.php

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\ContainerInterface;
2020
use Symfony\Component\DependencyInjection\Definition;
21-
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
2221
use Symfony\Component\DependencyInjection\Loader\FileLoader;
2322
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
2423
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
@@ -217,32 +216,20 @@ public function testRegisterClassesWithBadPrefix()
217216
}
218217

219218
/**
220-
* @dataProvider getIncompatibleExcludeTests
219+
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
220+
* @expectedExceptionMessage Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (yaml/*) is a subset of the "resource" pattern (Prototype/*)
221221
*/
222-
public function testRegisterClassesWithIncompatibleExclude($resourcePattern, $excludePattern)
222+
public function testRegisterClassesWithIncompatibleExclude()
223223
{
224224
$container = new ContainerBuilder();
225225
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
226226

227-
try {
228-
$loader->registerClasses(
229-
new Definition(),
230-
'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\\',
231-
$resourcePattern,
232-
$excludePattern
233-
);
234-
} catch (InvalidArgumentException $e) {
235-
$this->assertEquals(
236-
sprintf('Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $excludePattern, $resourcePattern),
237-
$e->getMessage()
238-
);
239-
}
240-
}
241-
242-
public function getIncompatibleExcludeTests()
243-
{
244-
yield array('Prototype/*', 'yaml/*', false);
245-
yield array('Prototype/OtherDir/*', 'Prototype/*', false);
227+
$loader->registerClasses(
228+
new Definition(),
229+
'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\\',
230+
'Prototype/*',
231+
'yaml/*'
232+
);
246233
}
247234
}
248235

0 commit comments

Comments
 (0)