Merge branch '4.3' into 4.4

* 4.3:
  fixed "link" to Contracts packages
  [WebProfilerBundle] Fix time panel legend buttons
  Fixed cache pools affecting each other due to an overwritten seed variable
  properly catch legacy tag syntax usages
This commit is contained in:
Fabien Potencier 2019-09-15 10:41:08 +02:00
commit 428367f8cf
6 changed files with 50 additions and 6 deletions

2
link
View File

@ -35,7 +35,7 @@ if (!is_dir("$pathToProject/vendor/symfony")) {
$sfPackages = array('symfony/symfony' => __DIR__);
$filesystem = new Filesystem();
$braces = array('Bundle', 'Bridge', 'Component', 'Component/Security');
$braces = array('Bundle', 'Bridge', 'Component', 'Component/Security', 'Contracts');
$directories = array_merge(...array_values(array_map(function ($part) {
return glob(__DIR__.'/src/Symfony/'.$part.'/*', GLOB_ONLYDIR | GLOB_NOSORT);
}, $braces)));

View File

@ -222,7 +222,8 @@ class Legend {
this.toggle = this.toggle.bind(this);
this.createCategory = this.createCategory.bind(this);
this.categories = Array.from(this.theme.getDefaultCategories()).map(this.createCategory);
this.categories = [];
this.theme.getDefaultCategories().forEach(this.createCategory)
}
add(category) {
@ -240,6 +241,8 @@ class Legend {
this.element.appendChild(element);
this.categories.push(element);
return element;
}

View File

@ -79,11 +79,12 @@ class CachePoolPass implements CompilerPassInterface
}
$name = $tags[0]['name'] ?? $id;
if (!isset($tags[0]['namespace'])) {
$namespaceSeed = $seed;
if (null !== $class) {
$seed .= '.'.$class;
$namespaceSeed .= '.'.$class;
}
$tags[0]['namespace'] = $this->getNamespace($seed, $name);
$tags[0]['namespace'] = $this->getNamespace($namespaceSeed, $name);
}
if (isset($tags[0]['clearer'])) {
$clearer = $tags[0]['clearer'];

View File

@ -70,6 +70,33 @@ class CachePoolPassTest extends TestCase
$this->assertSame('xmOJ8gqF-Y', $cachePool->getArgument(0));
}
public function testNamespaceArgumentIsSeededWithAdapterClassNameWithoutAffectingOtherCachePools()
{
$container = new ContainerBuilder();
$container->setParameter('kernel.container_class', 'app');
$container->setParameter('kernel.project_dir', 'foo');
$adapter = new Definition();
$adapter->setAbstract(true);
$adapter->addTag('cache.pool');
$adapter->setClass(RedisAdapter::class);
$container->setDefinition('app.cache_adapter', $adapter);
$container->setAlias('app.cache_adapter_alias', 'app.cache_adapter');
$otherCachePool = new ChildDefinition('app.cache_adapter_alias');
$otherCachePool->addArgument(null);
$otherCachePool->addTag('cache.pool');
$container->setDefinition('app.other_cache_pool', $otherCachePool);
$cachePool = new ChildDefinition('app.cache_adapter_alias');
$cachePool->addArgument(null);
$cachePool->addTag('cache.pool');
$container->setDefinition('app.cache_pool', $cachePool);
$this->cachePoolPass->process($container);
$this->assertSame('xmOJ8gqF-Y', $cachePool->getArgument(0));
}
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
{
$container = new ContainerBuilder();

View File

@ -674,7 +674,7 @@ class Inline
$nextOffset += strspn($value, ' ', $nextOffset);
// Is followed by a scalar and is a built-in tag
if ($tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && ('!' === $tag[0] || 'str' === $tag || 'php/const' === $tag || 'php/object' === $tag)) {
if ('' !== $tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && ('!' === $tag[0] || 'str' === $tag || 'php/const' === $tag || 'php/object' === $tag)) {
// Manage in {@link self::evaluateScalar()}
return null;
}
@ -682,10 +682,14 @@ class Inline
$i = $nextOffset;
// Built-in tags
if ($tag && '!' === $tag[0]) {
if ('' !== $tag && '!' === $tag[0]) {
throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
if ('' !== $tag && !isset($value[$i])) {
throw new ParseException(sprintf('Missing value for tag "%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
if ('' === $tag || Yaml::PARSE_CUSTOM_TAGS & $flags) {
return $tag;
}

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
@ -1841,6 +1842,14 @@ YAML;
$this->assertSame($expected, $this->parser->parse($yaml, Yaml::PARSE_CONSTANT));
}
public function testDeprecatedPhpConstantSyntax()
{
$this->expectException(ParseException::class);
$this->expectExceptionMessage('Missing value for tag "php/const:App\Kernel::SEMART_VERSION" at line 1 (near "!php/const:App\Kernel::SEMART_VERSION").');
$this->parser->parse('!php/const:App\Kernel::SEMART_VERSION', Yaml::PARSE_CUSTOM_TAGS | Yaml::PARSE_CONSTANT);
}
public function testMergeKeysWhenMappingsAreParsedAsObjects()
{
$yaml = <<<YAML