Skip to content
Permalink
Browse files

Merge branch '4.3' into 4.4

* 4.3:
  Re-enable push support for HttpClient
  [DependencyInjection] Accept existing interfaces as valid named args
  Fixed incompatibility between ServiceSubscriberTrait and classes with protected $container property
  • Loading branch information...
nicolas-grekas committed Sep 11, 2019
2 parents 9c3345f + 6ea7f30 commit 789448b65ced6e59fd1b9e7339c069051b5f08c1
@@ -53,7 +53,7 @@ protected function processValue($value, $isRoot = false)
$parameters = $r->getParameters();
}
if (isset($key[0]) && '$' !== $key[0] && !class_exists($key)) {
if (isset($key[0]) && '$' !== $key[0] && !class_exists($key) && !interface_exists($key, false)) {
throw new InvalidArgumentException(sprintf('Invalid service "%s": did you forget to add the "$" prefix to argument "%s"?', $this->currentId, $key));
}
@@ -12,6 +12,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Compiler\ResolveNamedArgumentsPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -152,6 +153,19 @@ public function testTypedArgumentWithMissingDollar()
$pass->process($container);
}
public function testInterfaceTypedArgument()
{
$container = new ContainerBuilder();
$definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class);
$definition->setArgument(ContainerInterface::class, $expected = new Reference('foo'));
$pass = new ResolveNamedArgumentsPass();
$pass->process($container);
$this->assertSame($expected, $definition->getArgument(3));
}
public function testResolvesMultipleArgumentsOfTheSameType()
{
$container = new ContainerBuilder();
@@ -2,12 +2,14 @@
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
use Psr\Container\ContainerInterface;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NamedArgumentsDummy
{
public function __construct(CaseSensitiveClass $c, $apiKey, $hostName)
public function __construct(CaseSensitiveClass $c, $apiKey, $hostName, ContainerInterface $interface)
{
}
@@ -58,7 +58,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
*
* @see HttpClientInterface::OPTIONS_DEFAULTS for available options
*/
public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 0)
public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50)
{
if (!\extension_loaded('curl')) {
throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.');
@@ -22,7 +22,7 @@
trait ServiceSubscriberTrait
{
/** @var ContainerInterface */
private $container;
protected $container;
public static function getSubscribedServices(): array
{

0 comments on commit 789448b

Please sign in to comment.
You can’t perform that action at this time.