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

Skip to content

Commit 8358ca7

Browse files
add subpattern name
1 parent 82d1db4 commit 8358ca7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Symfony/Bundle/TwigBundle/Loader/NativeFilesystemLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function findTemplate($template, $throw = true)
2424
try {
2525
return parent::findTemplate($template, $throw);
2626
} catch (LoaderError $e) {
27-
if ('' === $template || '@' === $template[0] || !preg_match('/^([^:]*?)(?:Bundle)?:([^:]*+):(.+\.[^\.]+\.[^\.]+)$/', $template, $m)) {
27+
if ('' === $template || '@' === $template[0] || !preg_match("/^(?P<bundlename>[^:]*?)(?:Bundle)?:(?P<path>[^:]*+):(?P<template>.+\.[^\.]+\.[^\.]+)$/", $template, $m)) {
2828
throw $e;
2929
}
3030
if ('' !== $m[2]) {

src/Symfony/Bundle/TwigBundle/Tests/Loader/NativeFilesystemLoaderTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77

88
class NativeFilesystemLoaderTest extends TestCase
99
{
10-
const DS = DIRECTORY_SEPARATOR;
11-
1210
public function testWithNativeNamespace()
1311
{
1412
$loader = new NativeFilesystemLoader(null, __DIR__.'/../');
1513
$loader->addPath('Fixtures/templates', 'Test');
1614

17-
$this->assertSame('Fixtures'.self::DS.'templates'.self::DS.'Foo'.self::DS.'index.html.twig', $loader->getCacheKey('@Test/Foo/index.html.twig'));
15+
$this->assertSame('Fixtures'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'Foo'.DIRECTORY_SEPARATOR.'index.html.twig', $loader->getCacheKey('@Test/Foo/index.html.twig'));
1816
}
1917

2018
/**

0 commit comments

Comments
 (0)