Merge branch '4.4' into 5.0

* 4.4:
  Fix CS
  Fix CS
  Fix CS
  [DependencyInjection][Xml] Fix the attribute 'tag' is not allowed in 'bind' tag
This commit is contained in:
Fabien Potencier 2019-12-01 09:48:26 +01:00
commit c13974cc20
18 changed files with 16 additions and 24 deletions

View File

@ -218,10 +218,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
}
}
throw new InvalidArgumentException(sprintf(
'Could not find the manager name parameter in the container. Tried the following parameter names: "%s"',
implode('", "', $this->managerParameters)
));
throw new InvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s"', implode('", "', $this->managerParameters)));
}
/**

View File

@ -222,6 +222,7 @@
<xsd:attribute name="key" type="xsd:string" use="required" />
<xsd:attribute name="on-invalid" type="invalid_sequence" />
<xsd:attribute name="method" type="xsd:string" />
<xsd:attribute name="tag" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="argument" mixed="true">

View File

@ -19,7 +19,6 @@ use Symfony\Component\DependencyInjection\Compiler\DefinitionErrorExceptionPass;
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;

View File

@ -15,7 +15,7 @@ class Bar implements BarInterface
{
public $quz;
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [])
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [], iterable $baz = [])
{
$this->quz = $quz;
}

View File

@ -12,6 +12,7 @@
<bind key="$foo" type="collection">
<bind>null</bind>
</bind>
<bind key="iterable $baz" type="tagged_iterator" tag="bar"/>
</service>
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\Bar">

View File

@ -12,6 +12,7 @@ services:
bind:
Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface: '@Symfony\Component\DependencyInjection\Tests\Fixtures\Bar'
$foo: [ ~ ]
iterable $baz: !tagged_iterator bar
Symfony\Component\DependencyInjection\Tests\Fixtures\Bar:
factory: [ ~, 'create' ]

View File

@ -879,12 +879,14 @@ class XmlFileLoaderTest extends TestCase
'$foo' => [null],
'$quz' => 'quz',
'$factory' => 'factory',
'iterable $baz' => new TaggedIteratorArgument('bar'),
], array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
$this->assertEquals([
'quz',
null,
new Reference(Bar::class),
[null],
new TaggedIteratorArgument('bar'),
], $definition->getArguments());
$definition = $container->getDefinition(Bar::class);

View File

@ -769,12 +769,14 @@ class YamlFileLoaderTest extends TestCase
'$foo' => [null],
'$quz' => 'quz',
'$factory' => 'factory',
'iterable $baz' => new TaggedIteratorArgument('bar'),
], array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
$this->assertEquals([
'quz',
null,
new Reference(Bar::class),
[null],
new TaggedIteratorArgument('bar'),
], $definition->getArguments());
$definition = $container->getDefinition(Bar::class);

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\ErrorHandler\Tests\ErrorRenderer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
class HtmlErrorRendererTest extends TestCase
{

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\ErrorHandler\Tests\ErrorRenderer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\ErrorHandler\ErrorRenderer\SerializerErrorRenderer;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ProblemNormalizer;
use Symfony\Component\Serializer\Serializer;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Tests;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigInterface;
use Symfony\Component\Form\FormTypeExtensionInterface;

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\Tests\Controller;
use PHPUnit\Framework\TestCase;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Controller\ErrorController;

View File

@ -75,11 +75,7 @@ final class Ldap implements LdapInterface
public static function create(string $adapter, array $config = []): self
{
if (!isset(self::$adapterMap[$adapter])) {
throw new DriverNotFoundException(sprintf(
'Adapter "%s" not found. You should use one of: %s',
$adapter,
implode(', ', self::$adapterMap)
));
throw new DriverNotFoundException(sprintf('Adapter "%s" not found. You should use one of: %s', $adapter, implode(', ', self::$adapterMap)));
}
$class = self::$adapterMap[$adapter];

View File

@ -13,8 +13,8 @@ namespace Symfony\Component\Mailer\Transport;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mailer\Event\MessageEvent;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mime\Address;

View File

@ -93,9 +93,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
throw new NoConfigurationException();
}
throw 0 < \count($this->allow)
? new MethodNotAllowedException(array_unique($this->allow))
: new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo));
throw 0 < \count($this->allow) ? new MethodNotAllowedException(array_unique($this->allow)) : new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo));
}
/**

View File

@ -222,7 +222,7 @@ class ContextListenerTest extends TestCase
->willReturn(true);
$request->expects($this->any())
->method('getSession')
->will($this->returnValue($session));
->willReturn($session);
$event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST, new Response());

View File

@ -222,14 +222,14 @@ class Exporter
));
if ("'" === $m[2]) {
return substr($m[1], 0, -2);
return substr($m[1], 0, -2);
}
if ('n".\'' === substr($m[1], -4)) {
return substr_replace($m[1], "\n".$subIndent.".'".$m[2], -2);
return substr_replace($m[1], "\n".$subIndent.".'".$m[2], -2);
}
return $m[1].$m[2];
return $m[1].$m[2];
}, $code, -1, $count);
if ($count && 0 === strpos($code, "''.")) {