Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fba7e54

Browse filesBrowse files
committed
added foward compatibility for the removal of bundle inheritance in 4.0
1 parent 701d41c commit fba7e54
Copy full SHA for fba7e54

File tree

Expand file treeCollapse file tree

5 files changed

+40
-12
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+40
-12
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ public function parse($controller)
7373
throw new \InvalidArgumentException($message, 0, $e);
7474
}
7575

76+
if (!is_array($allBundles)) {
77+
// happens when HttpKernel is version 4+
78+
$allBundles = array($allBundles);
79+
}
80+
7681
foreach ($allBundles as $b) {
7782
$try = $b->getNamespace().'\\Controller\\'.$controller.'Controller';
7883
if (class_exists($try)) {

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Console\Tester\CommandTester;
1717
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
1818
use Symfony\Component\Filesystem\Filesystem;
19+
use Symfony\Component\HttpKernel;
1920

2021
class TranslationDebugCommandTest extends TestCase
2122
{
@@ -141,14 +142,21 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
141142
);
142143

143144
if (null === $kernel) {
145+
$returnValues = array(
146+
array('foo', $this->getBundle($this->translationDir)),
147+
array('test', $this->getBundle('test')),
148+
);
149+
if (HttpKernel\Kernel::VERSION_ID < 40000) {
150+
$returnValues = array(
151+
array('foo', true, $this->getBundle($this->translationDir)),
152+
array('test', true, $this->getBundle('test')),
153+
);
154+
}
144155
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
145156
$kernel
146157
->expects($this->any())
147158
->method('getBundle')
148-
->will($this->returnValueMap(array(
149-
array('foo', true, $this->getBundle($this->translationDir)),
150-
array('test', true, $this->getBundle('test')),
151-
)));
159+
->will($this->returnValueMap($returnValues));
152160
}
153161

154162
$kernel

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,21 @@ private function createCommandTester($extractedMessages = array(), $loadedMessag
120120
);
121121

122122
if (null === $kernel) {
123+
$returnValues = array(
124+
array('foo', $this->getBundle($this->translationDir)),
125+
array('test', $this->getBundle('test')),
126+
);
127+
if (HttpKernel\Kernel::VERSION_ID < 40000) {
128+
$returnValues = array(
129+
array('foo', true, $this->getBundle($this->translationDir)),
130+
array('test', true, $this->getBundle('test')),
131+
);
132+
}
123133
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
124134
$kernel
125135
->expects($this->any())
126136
->method('getBundle')
127-
->will($this->returnValueMap(array(
128-
array('foo', true, $this->getBundle($this->translationDir)),
129-
array('test', true, $this->getBundle('test')),
130-
)));
137+
->will($this->returnValueMap($returnValues));
131138
}
132139

133140
$kernel

‎src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Composer\Autoload\ClassLoader;
1515
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1616
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
17+
use Symfony\Component\HttpKernel\Kernel;
1718

1819
class ControllerNameParserTest extends TestCase
1920
{
@@ -98,10 +99,17 @@ public function testMissingControllers($name)
9899

99100
public function getMissingControllersTest()
100101
{
101-
return array(
102-
array('FooBundle:Fake:index'), // a normal bundle
103-
array('SensioFooBundle:Fake:index'), // a bundle with children
102+
// a normal bundle
103+
$bundles = array(
104+
array('FooBundle:Fake:index'),
104105
);
106+
107+
// a bundle with children
108+
if (Kernel::VERSION_ID < 40000) {
109+
$bundles[] = array('SensioFooBundle:Fake:index');
110+
}
111+
112+
return $bundles;
105113
}
106114

107115
/**

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private function getBundleHierarchy(ContainerBuilder $container, array $config)
214214
}
215215
$container->addResource(new FileExistenceResource($dir));
216216

217-
if (null === $bundle['parent']) {
217+
if (!isset($bundle['parent']) || null === $bundle['parent']) {
218218
continue;
219219
}
220220

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.