Merge branch '2.8' into 3.1
* 2.8: [WebProfilerBundle] Fix whitespace control in layout.html.twig [Validator] Fix init of YamlFileLoader::$classes for empty files
This commit is contained in:
commit
904dcfc733
@ -113,11 +113,11 @@
|
||||
<ul id="menu-profiler">
|
||||
{% for name, template in templates %}
|
||||
{% set menu -%}
|
||||
{% if block('menu', template) is defined %}
|
||||
{%- if block('menu', template) is defined -%}
|
||||
{% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}
|
||||
{{- block('menu', template) -}}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
{%- endset %}
|
||||
{% if menu is not empty %}
|
||||
<li class="{{ name }} {{ name == panel ? 'selected' : '' }}">
|
||||
|
@ -46,13 +46,7 @@ class YamlFileLoader extends FileLoader
|
||||
$this->yamlParser = new YamlParser();
|
||||
}
|
||||
|
||||
// This method may throw an exception. Do not modify the class'
|
||||
// state before it completes
|
||||
if (false === ($classes = $this->parseFile($this->file))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->classes = $classes;
|
||||
$this->classes = $this->parseFile($this->file);
|
||||
|
||||
if (isset($this->classes['namespaces'])) {
|
||||
foreach ($this->classes['namespaces'] as $alias => $namespace) {
|
||||
@ -111,7 +105,7 @@ class YamlFileLoader extends FileLoader
|
||||
*
|
||||
* @param string $path The path of the YAML file
|
||||
*
|
||||
* @return array|null The class descriptions or null, if the file was empty
|
||||
* @return array The class descriptions
|
||||
*
|
||||
* @throws \InvalidArgumentException If the file could not be loaded or did
|
||||
* not contain a YAML array
|
||||
@ -126,7 +120,7 @@ class YamlFileLoader extends FileLoader
|
||||
|
||||
// empty file
|
||||
if (null === $classes) {
|
||||
return;
|
||||
return array();
|
||||
}
|
||||
|
||||
// not an array
|
||||
|
@ -31,6 +31,10 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
|
||||
|
||||
$this->assertFalse($loader->loadClassMetadata($metadata));
|
||||
|
||||
$r = new \ReflectionProperty($loader, 'classes');
|
||||
$r->setAccessible(true);
|
||||
$this->assertSame(array(), $r->getValue($loader));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user