Skip to content

Commit 9f35b03

Browse files
committed
[DependencyInjection] Make the DefinitionErrorExceptionPass ignore the test container
1 parent 1fb9d17 commit 9f35b03

File tree

5 files changed

+40
-1
lines changed

5 files changed

+40
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer;
4+
5+
class Controller
6+
{
7+
public function __invoke(DTO $dto)
8+
{
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer;
4+
5+
class DTO
6+
{
7+
public function __construct(NestedDTO $nestedDto)
8+
{
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer;
4+
5+
class NestedDTO
6+
{
7+
public function __construct(int $notAutowireable)
8+
{
9+
}
10+
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/TestServiceContainer/services.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,12 @@ services:
2828
public: true
2929
tags:
3030
- kernel.reset: { method: 'myCustomName' }
31+
32+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\NestedDTO:
33+
autowire: true
34+
35+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\DTO:
36+
autowire: true
37+
38+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestServiceContainer\Controller:
39+
tags: ['controller.service_arguments']

src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
6464
return $value;
6565
}
6666

67-
if ($value instanceof Reference && $this->currentId !== $targetId = (string) $value) {
67+
if ($value instanceof Reference && 'test.private_services_locator' !== $this->currentId && $this->currentId !== $targetId = (string) $value) {
6868
if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
6969
$this->sourceReferences[$targetId][$this->currentId] ??= true;
7070
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy