Skip to content

Commit 842280f

Browse files
author
Robin Chalas
committed
Merge branch '5.0'
* 5.0: (47 commits) reset the kernel cache after each test [HttpKernel] Ability to define multiple kernel.reset tags [Routing] Continue supporting single colon in object route loaders [FWBundle] Remove unused parameter [Intl] [Workflow] fixes English grammar typos [Filesystem] [Serializer] fixes English grammar typo mailer: mailchimp bridge is throwing undefined index _id when setting message id in mandrill http transport has_roles should be is_granted in security upgrade file has_roles should be is_granted in upgrade files [HttpClient] Fix early cleanup of pushed HTTP/2 responses skip test on incompatible PHP versions [HttpKernel] Don't cache "not-fresh" state Drop WebServerBundle directory [FrameworkBundle][Cache] Don't deep-merge cache pools configuration [Messenger] Adding exception to amqp transport in case amqp ext is not installed [SecurityBundle] Don't require a user provider for the anonymous listener [DoctrineBridge] Fixed cs in DoctrineType [Monolog Bridge] Fixed accessing static property as non static. Improve Symfony description [Mailer] Add UPGRADE entries about Envelope and MessageEvent ...
2 parents 501d337 + dfbb4d1 commit 842280f

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

Argument/TaggedIteratorArgument.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class TaggedIteratorArgument extends IteratorArgument
2121
private $tag;
2222
private $indexAttribute;
2323
private $defaultIndexMethod;
24+
private $defaultPriorityMethod;
2425
private $needsIndexes = false;
2526

2627
/**

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ private function checkType(Definition $checkedDefinition, $value, \ReflectionPar
152152
return;
153153
}
154154

155+
if ('object' === $type) {
156+
return;
157+
}
158+
155159
if (is_a($class, $type, true)) {
156160
return;
157161
}

Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1616
use Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass;
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
use Symfony\Component\DependencyInjection\Definition;
1819
use Symfony\Component\DependencyInjection\Reference;
1920
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Bar;
2021
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
2122
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2223
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
2324
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Foo;
25+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\FooObject;
2426

2527
/**
2628
* @author Nicolas Grekas <[email protected]>
@@ -390,6 +392,21 @@ public function testProcessSuccessWhenPassingAnIteratorArgumentToIterable()
390392
$this->addToAssertionCount(1);
391393
}
392394

395+
/**
396+
* @requires PHP 7.2
397+
*/
398+
public function testProcessSuccessWhenPassingDefinitionForObjectType()
399+
{
400+
$container = new ContainerBuilder();
401+
402+
$container->register('foo_object', FooObject::class)
403+
->addArgument(new Definition(Foo::class));
404+
405+
(new CheckTypeDeclarationsPass(true))->process($container);
406+
407+
$this->addToAssertionCount(1);
408+
}
409+
393410
public function testProcessFactory()
394411
{
395412
$container = new ContainerBuilder();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
4+
5+
class FooObject
6+
{
7+
public function __construct(object $foo)
8+
{
9+
}
10+
}

0 commit comments

Comments
 (0)