Skip to content

Commit 2dff40f

Browse files
Merge branch '5.4' into 6.2
* 5.4: Do not check errored definitions’ type [HttpKernel] Fix restoring surrogate content from cache [HttpClient] Fix getting through proxies via CONNECT Remove legacy filters remnants
2 parents d732a66 + 4645e03 commit 2dff40f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
207207
$class = null;
208208

209209
if ($value instanceof Definition) {
210-
if ($value->getFactory()) {
210+
if ($value->hasErrors() || $value->getFactory()) {
211211
return;
212212
}
213213

Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
2424
use Symfony\Component\DependencyInjection\Reference;
2525
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Bar;
26+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarErroredDependency;
2627
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
2728
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2829
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
@@ -980,6 +981,20 @@ public function testIgnoreDefinitionFactoryArgument()
980981

981982
$this->addToAssertionCount(1);
982983
}
984+
985+
public function testErroredDefinitionsAreNotChecked()
986+
{
987+
$container = new ContainerBuilder();
988+
$container->register('errored_dependency', BarErroredDependency::class)
989+
->setArguments([
990+
(new Definition(Foo::class))
991+
->addError('error'),
992+
]);
993+
994+
(new CheckTypeDeclarationsPass(true))->process($container);
995+
996+
$this->addToAssertionCount(1);
997+
}
983998
}
984999

9851000
class CallableClass
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 BarErroredDependency
6+
{
7+
public function __construct(\stdClass $foo)
8+
{
9+
}
10+
}

0 commit comments

Comments
 (0)