Skip to content

Commit 892f58c

Browse files
Merge branch '5.2' into 5.3
* 5.2: [DependencyInjection] Fix testServiceSubscriber for PHP 8.1
2 parents ad4c497 + 24371d4 commit 892f58c

File tree

2 files changed

+112
-1
lines changed

2 files changed

+112
-1
lines changed

Tests/Dumper/PhpDumperTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,11 @@ public function process(ContainerBuilder $container)
973973

974974
$dumper = new PhpDumper($container);
975975

976-
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump());
976+
if (80100 <= \PHP_VERSION_ID) {
977+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber_php81.php', $dumper->dump());
978+
} else {
979+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_subscriber.php', $dumper->dump());
980+
}
977981
}
978982

979983
public function testPrivateWithIgnoreOnInvalidReference()
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
3+
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
4+
use Symfony\Component\DependencyInjection\ContainerInterface;
5+
use Symfony\Component\DependencyInjection\Container;
6+
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
7+
use Symfony\Component\DependencyInjection\Exception\LogicException;
8+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
9+
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
11+
12+
/**
13+
* @internal This class has been auto-generated by the Symfony Dependency Injection Component.
14+
*/
15+
class ProjectServiceContainer extends Container
16+
{
17+
protected $parameters = [];
18+
protected $getService;
19+
20+
public function __construct()
21+
{
22+
$this->getService = \Closure::fromCallable([$this, 'getService']);
23+
$this->services = $this->privates = [];
24+
$this->methodMap = [
25+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'getTestServiceSubscriberService',
26+
'foo_service' => 'getFooServiceService',
27+
'late_alias' => 'getLateAliasService',
28+
];
29+
$this->aliases = [
30+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1' => 'late_alias',
31+
];
32+
}
33+
34+
public function compile(): void
35+
{
36+
throw new LogicException('You cannot compile a dumped container that was already compiled.');
37+
}
38+
39+
public function isCompiled(): bool
40+
{
41+
return true;
42+
}
43+
44+
public function getRemovedIds(): array
45+
{
46+
return [
47+
'.service_locator.JmEob1b' => true,
48+
'.service_locator.JmEob1b.foo_service' => true,
49+
'.service_locator.KIgkoLM' => true,
50+
'Psr\\Container\\ContainerInterface' => true,
51+
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
52+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true,
53+
];
54+
}
55+
56+
/**
57+
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber' shared service.
58+
*
59+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber
60+
*/
61+
protected function getTestServiceSubscriberService()
62+
{
63+
return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber();
64+
}
65+
66+
/**
67+
* Gets the public 'foo_service' shared autowired service.
68+
*
69+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber
70+
*/
71+
protected function getFooServiceService()
72+
{
73+
return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($this->getService, [
74+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
75+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
76+
'bar' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
77+
'baz' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
78+
'late_alias' => ['services', 'late_alias', 'getLateAliasService', false],
79+
], [
80+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
81+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber',
82+
'bar' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
83+
'baz' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
84+
'late_alias' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1',
85+
]))->withContext('foo_service', $this));
86+
}
87+
88+
/**
89+
* Gets the public 'late_alias' shared service.
90+
*
91+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1
92+
*/
93+
protected function getLateAliasService()
94+
{
95+
return $this->services['late_alias'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1();
96+
}
97+
98+
/**
99+
* Gets the private 'Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition' shared service.
100+
*
101+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition
102+
*/
103+
protected function getCustomDefinitionService()
104+
{
105+
return $this->privates['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
106+
}
107+
}

0 commit comments

Comments
 (0)