Merge branch '3.2' into 3.3
* 3.2: [TwigBridge] Fix namespaced classes [Cache] MemcachedAdapter not working with TagAwareAdapter [DependencyInjection] Use more clear message when unused environment variables detected mix attr options between type-guess options and user options
This commit is contained in:
commit
7769179e0f
@ -14,6 +14,7 @@ namespace Symfony\Bridge\Twig\NodeVisitor;
|
||||
use Symfony\Bridge\Twig\Node\TransNode;
|
||||
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
|
||||
use Twig\Environment;
|
||||
use Twig\Node\BlockNode;
|
||||
use Twig\Node\Expression\ArrayExpression;
|
||||
use Twig\Node\Expression\AssignNameExpression;
|
||||
use Twig\Node\Expression\ConstantExpression;
|
||||
@ -21,6 +22,7 @@ use Twig\Node\Expression\FilterExpression;
|
||||
use Twig\Node\Expression\NameExpression;
|
||||
use Twig\Node\ModuleNode;
|
||||
use Twig\Node\Node;
|
||||
use Twig\Node\SetNode;
|
||||
use Twig\NodeVisitor\AbstractNodeVisitor;
|
||||
|
||||
/**
|
||||
@ -48,7 +50,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
||||
*/
|
||||
protected function doEnterNode(Node $node, Environment $env)
|
||||
{
|
||||
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
|
||||
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
|
||||
$this->scope = $this->scope->enter();
|
||||
}
|
||||
|
||||
@ -62,7 +64,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
||||
$name = new AssignNameExpression($var, $node->getTemplateLine());
|
||||
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
|
||||
|
||||
return new Node_Set(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
|
||||
return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +106,7 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
|
||||
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
|
||||
$this->scope = $this->scope->leave();
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
if (!$tagKeys) {
|
||||
yield $key => $f($item, self::TAGS_PREFIX.$key, $itemTags);
|
||||
yield $key => $f($item, static::TAGS_PREFIX.$key, $itemTags);
|
||||
continue;
|
||||
}
|
||||
if (!isset($tagKeys[$key])) {
|
||||
@ -306,7 +306,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
||||
$tagVersions = $tagKeys = null;
|
||||
|
||||
foreach ($bufferedItems as $key => $item) {
|
||||
yield $key => $f($item, self::TAGS_PREFIX.$key, $itemTags);
|
||||
yield $key => $f($item, static::TAGS_PREFIX.$key, $itemTags);
|
||||
}
|
||||
$bufferedItems = null;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class PhpDumper extends Dumper
|
||||
}
|
||||
}
|
||||
if ($unusedEnvs) {
|
||||
throw new EnvParameterException($unusedEnvs);
|
||||
throw new EnvParameterException($unusedEnvs, null, 'Environment variables "%s" are never used. Please, check your container\'s configuration.');
|
||||
}
|
||||
|
||||
return $code;
|
||||
|
@ -18,8 +18,8 @@ namespace Symfony\Component\DependencyInjection\Exception;
|
||||
*/
|
||||
class EnvParameterException extends InvalidArgumentException
|
||||
{
|
||||
public function __construct(array $usedEnvs, \Exception $previous = null)
|
||||
public function __construct(array $envs, \Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
|
||||
{
|
||||
parent::__construct(sprintf('Incompatible use of dynamic environment variables "%s" found in parameters.', implode('", "', $usedEnvs)), 0, $previous);
|
||||
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ class PhpDumperTest extends TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
|
||||
* @expectedExceptionMessage Incompatible use of dynamic environment variables "FOO" found in parameters.
|
||||
* @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration.
|
||||
*/
|
||||
public function testUnusedEnvParameter()
|
||||
{
|
||||
|
@ -115,7 +115,13 @@ class FormFactory implements FormFactoryInterface
|
||||
|
||||
// user options may override guessed options
|
||||
if ($typeGuess) {
|
||||
$options = array_merge($typeGuess->getOptions(), $options);
|
||||
$attrs = array();
|
||||
$typeGuessOptions = $typeGuess->getOptions();
|
||||
if (isset($typeGuessOptions['attr']) && isset($options['attr'])) {
|
||||
$attrs = array('attr' => array_merge($typeGuessOptions['attr'], $options['attr']));
|
||||
}
|
||||
|
||||
$options = array_merge($typeGuessOptions, $options, $attrs);
|
||||
}
|
||||
|
||||
return $this->createNamedBuilder($property, $type, $data, $options);
|
||||
|
@ -310,7 +310,7 @@ class FormFactoryTest extends TestCase
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new TypeGuess(
|
||||
'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
array('attr' => array('maxlength' => 10)),
|
||||
array('attr' => array('class' => 'foo', 'maxlength' => 10)),
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
|
||||
@ -318,7 +318,7 @@ class FormFactoryTest extends TestCase
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('maxlength' => 11)))
|
||||
->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('class' => 'foo', 'maxlength' => 11)))
|
||||
->will($this->returnValue('builderInstance'));
|
||||
|
||||
$this->builder = $factory->createBuilderForProperty(
|
||||
|
Reference in New Issue
Block a user