Skip to content

Commit 1876b4f

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: Static code analysis Update AnnotationDirectoryLoader.php [FrameworkBundle] Fix template location for PHP templates [FrameworkBundle] Add path verification to the template parsing test cases
2 parents 96eb903 + 89e8619 commit 1876b4f

File tree

32 files changed

+78
-70
lines changed

32 files changed

+78
-70
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function setMappingDriverConfig(array $mappingConfig, $mappingName)
153153
*/
154154
protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container)
155155
{
156-
$bundleDir = dirname($bundle->getFilename());
156+
$bundleDir = dirname($bundle->getFileName());
157157

158158
if (!$bundleConfig['type']) {
159159
$bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container);

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function updateValidatorMappingFiles(ContainerBuilder $container, $mappi
6060

6161
foreach ($container->getParameter('kernel.bundles') as $bundle) {
6262
$reflection = new \ReflectionClass($bundle);
63-
if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) {
63+
if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
6464
$files[] = realpath($file);
6565
$container->addResource(new FileResource($file));
6666
}

src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ build: 56
117117
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat;
118118
}
119119
.sf-button .btn-bg {
120-
padding: 0px 14px;
120+
padding: 0 14px;
121121
color: #636363;
122122
line-height: 28px;
123123
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left;

src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function parse($name)
5555
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
5656
}
5757

58-
if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
58+
if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
5959
return parent::parse($name);
6060
}
6161

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,33 @@ protected function tearDown()
4343
}
4444

4545
/**
46-
* @dataProvider getLogicalNameToTemplateProvider
46+
* @dataProvider parseProvider
4747
*/
48-
public function testParse($name, $ref)
48+
public function testParse($name, $logicalName, $path, $ref)
4949
{
5050
$template = $this->parser->parse($name);
5151

52-
$this->assertEquals($template->getLogicalName(), $ref->getLogicalName());
53-
$this->assertEquals($template->getLogicalName(), $name);
52+
$this->assertSame($ref->getLogicalName(), $template->getLogicalName());
53+
$this->assertSame($logicalName, $template->getLogicalName());
54+
$this->assertSame($path, $template->getPath());
5455
}
5556

56-
public function getLogicalNameToTemplateProvider()
57+
public function parseProvider()
5758
{
5859
return array(
59-
array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
60-
array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
61-
array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
62-
array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
63-
array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
64-
array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
65-
array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
66-
array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
67-
array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
68-
array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
69-
array('name', new BaseTemplateReference('name')),
60+
array('FooBundle:Post:index.html.php', 'FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
61+
array('FooBundle:Post:index.html.twig', 'FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
62+
array('FooBundle:Post:index.xml.php', 'FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
63+
array('SensioFooBundle:Post:index.html.php', 'SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
64+
array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
65+
array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
66+
array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
67+
array('index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
68+
array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
69+
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
70+
array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
71+
array('name', 'name', 'name', new BaseTemplateReference('name')),
72+
array('default/index.html.php', '::default/index.html.php', 'views/default/index.html.php', new TemplateReference(null, null, 'default/index', 'html', 'php')),
7073
);
7174
}
7275

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/body.css.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ build: 56
116116
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat;
117117
}
118118
.sf-button .btn-bg {
119-
padding: 0px 14px;
119+
padding: 0 14px;
120120
color: #636363;
121121
line-height: 28px;
122122
background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left;

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@
6363
<script>//<![CDATA[
6464
6565
function toggleMenuPanels(state, doSave) {
66-
var menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'),
67-
displayState, elem, className;
66+
var menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'), displayState;
6867
6968
if (null === savedState) {
7069
savedState = 'block';

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pre, code {
134134
}
135135
#menu-profiler li a span.label {
136136
display: block;
137-
padding: 20px 0px 16px 65px;
137+
padding: 20px 0 16px 65px;
138138
min-height: 16px;
139139
overflow: hidden;
140140
}
@@ -285,7 +285,6 @@ ul.alt li.scream, ul.alt li.scream strong {
285285
color: gray;
286286
}
287287
ul.sf-call-stack li {
288-
text-size: small;
289288
padding: 0 0 0 20px;
290289
}
291290
td.main, td.menu {
@@ -385,13 +384,12 @@ td.main, td.menu {
385384
line-height: 1.5em;
386385
}
387386
.sf-profiler-timeline .legends span {
388-
border-left-width: 10px;
389-
border-left-style: solid;
387+
border-left: 10px solid;
390388
padding: 0 10px 0 5px;
391389
}
392390
.sf-profiler-timeline canvas {
393-
border: 1px solid #999;
394-
border-width: 1px 0;
391+
border: 1px #999;
392+
border-style: solid none;
395393
}
396394
.collapsed-menu-parents #resume,
397395
.collapsed-menu-parents #collector-content {

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@
104104
}
105105

106106
.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status {
107-
padding: 0px 5px;
107+
padding: 0 5px;
108108
border-radius: 5px;
109-
margin-bottom: 0px;
109+
margin-bottom: 0;
110110
vertical-align: top;
111111
}
112112

@@ -140,13 +140,11 @@
140140
display: none;
141141
position: absolute;
142142
background-color: #fff;
143-
border: 1px solid #bbb;
144143
padding: 9px 0;
145144
margin-left: -1px;
146145

147146
bottom: 38px;
148-
border-bottom-width: 0;
149-
border-bottom: 1px solid #bbb;
147+
border: 1px solid #bbb;
150148
border-radius: 4px 4px 0 0;
151149
}
152150

@@ -205,7 +203,7 @@
205203
}
206204

207205
.sf-toolbar-block .sf-toolbar-icon > a,
208-
.sf-toolbar-block .sf-toolbar-icon > a:link
206+
.sf-toolbar-block .sf-toolbar-icon > a:link,
209207
.sf-toolbar-block .sf-toolbar-icon > a:hover {
210208
color: black !important;
211209
}

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public function testReturns404onTokenNotFound()
6262
if ('found' == $token) {
6363
return new Profile($token);
6464
}
65-
66-
return;
6765
}))
6866
;
6967

0 commit comments

Comments
 (0)