Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60b1c5b

Browse files
Added CHANGELOG entries, cleanups
1 parent 73f0ee2 commit 60b1c5b

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<parameter key="routing.loader.xml.class">Symfony\Component\Routing\Loader\XmlFileLoader</parameter>
1313
<parameter key="routing.loader.yml.class">Symfony\Component\Routing\Loader\YamlFileLoader</parameter>
1414
<parameter key="routing.loader.php.class">Symfony\Component\Routing\Loader\PhpFileLoader</parameter>
15-
<parameter key="routing.loader.directory.class">Symfony\Component\Routing\Loader\DirectoryLoader</parameter>
1615
<parameter key="router.options.generator_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
1716
<parameter key="router.options.generator_base_class">Symfony\Component\Routing\Generator\UrlGenerator</parameter>
1817
<parameter key="router.options.generator_dumper_class">Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper</parameter>
@@ -46,7 +45,7 @@
4645
<argument type="service" id="file_locator" />
4746
</service>
4847

49-
<service id="routing.loader.directory" class="%routing.loader.directory.class%" public="false">
48+
<service id="routing.loader.directory" class="Symfony\Component\Routing\Loader\DirectoryLoader" public="false">
5049
<tag name="routing.loader" />
5150
<argument type="service" id="file_locator" />
5251
</service>

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
2.8.0
5+
-----
6+
7+
* allowed specifying a directory to recursively load all configuration files it contains
8+
49
2.7.0
510
-----
611

src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\Config\Resource\DirectoryResource;
1515

1616
/**
17-
* DirectoryLoader is a recursive loader to go through directories
17+
* DirectoryLoader is a recursive loader to go through directories.
1818
*
1919
* @author Sebastien Lavoie <[email protected]>
2020
*/
@@ -30,7 +30,7 @@ public function load($file, $type = null)
3030
$this->container->addResource(new DirectoryResource($path));
3131

3232
foreach (scandir($path) as $dir) {
33-
if ($dir[0] !== '.') {
33+
if ('.' !== $dir[0]) {
3434
if (is_dir($path.'/'.$dir)) {
3535
$dir .= '/'; // append / to allow recursion
3636
}
@@ -51,10 +51,6 @@ public function supports($resource, $type = null)
5151
return true;
5252
}
5353

54-
if (null === $type) {
55-
return preg_match('/\/$/', $resource) === 1;
56-
}
57-
58-
return false;
54+
return null === $type && is_string($resource) && '/' === substr($resource, -1);
5955
}
6056
}

src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ public function testImports()
5858
}
5959

6060
/**
61-
* @covers Symfony\Component\DependencyInjection\Loader\DirectoryLoader::__construct
62-
* @covers Symfony\Component\DependencyInjection\Loader\DirectoryLoader::load
63-
*
6461
* @expectedException \InvalidArgumentException
6562
* @expectedExceptionMessage The file "foo" does not exist (in:
6663
*/
@@ -69,12 +66,9 @@ public function testExceptionIsRaisedWhenDirectoryDoesNotExist()
6966
$this->loader->load('foo/');
7067
}
7168

72-
/**
73-
* @covers Symfony\Component\DependencyInjection\Loader\DirectoryLoader::supports
74-
*/
7569
public function testSupports()
7670
{
77-
$loader = new DirectoryLoader(new ContainerBuilder(), new FileLocator());
71+
$loader = new DirectoryLoader(new ContainerBuilder(), new FileLocator());
7872

7973
$this->assertTrue($loader->supports('directory/'), '->supports("directory/") returns true');
8074
$this->assertTrue($loader->supports('directory/', 'directory'), '->supports("directory/", "directory") returns true');

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/expression-language": "~2.4|~3.0.0",
3535
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
3636
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
37-
"symfony/routing": "~2.7|~3.0.0",
37+
"symfony/routing": "~2.8|~3.0.0",
3838
"symfony/stopwatch": "~2.3|~3.0.0",
3939
"symfony/templating": "~2.2|~3.0.0",
4040
"symfony/translation": "~2.0,>=2.0.5|~3.0.0",

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
2.8.0
5+
-----
6+
7+
* allowed specifying a directory to recursively load all routing configuration files it contains
8+
49
2.5.0
510
-----
611

src/Symfony/Component/Routing/Loader/DirectoryLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function load($file, $type = null)
2828
$collection->addResource(new DirectoryResource($path));
2929

3030
foreach (scandir($path) as $dir) {
31-
if ($dir[0] !== '.') {
31+
if ('.' !== $dir[0]) {
3232
$this->setCurrentDir($path);
3333
$subPath = $path.'/'.$dir;
3434
$subType = null;

src/Symfony/Component/Routing/Tests/Loader/DirectoryLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function verifyCollection(RouteCollection $collection)
5858
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
5959

6060
for ($i = 1; $i <= 3; $i++) {
61-
$this->assertSame('/route/'.$i, $routes["route".$i]->getPath());
61+
$this->assertSame('/route/'.$i, $routes['route'.$i]->getPath());
6262
}
6363
}
6464

0 commit comments

Comments
 (0)