8000 Merge branch '4.4' into 5.2 · symfony/symfony@3aa392a · GitHub
[go: up one dir, main page]

Skip to content

Commit 3aa392a

Browse files
Merge branch '4.4' into 5.2
* 4.4: [DependencyInjection] Fix testServiceSubscriber for PHP 8.1
2 parents 3004b9c + 7ca0995 commit 3aa392a

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

src/Symfony/Component/DependencyInjection/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: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
'Psr\\Container\\ContainerInterface' => true,
50+
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
51+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true,
52+
];
53+
}
54+
55+
/**
56+
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber' shared service.
57+
*
58+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber
59+
*/
60+
protected function getTestServiceSubscriberService()
61+
{
62+
return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber();
63+
}
64+
65+
/**
66+
* Gets the public 'foo_service' shared autowired service.
67+
*
68+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber
69+
*/
70+
protected function getFooServiceService()
71+
{
72+
return $this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($this->getService, [
73+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
74+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
75+
'bar' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false],
76+
'baz' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false],
77+
'late_alias' => ['services', 'late_alias', 'getLateAliasService', false],
78+
], [
79+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
80+
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber',
81+
'bar' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
82+
'baz' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition',
83+
'late_alias' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1',
84+
]))->withContext('foo_service', $this));
85+
}
86+
87+
/**
88+
* Gets the public 'late_alias' shared service.
89+
*
90+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1
91+
*/
92+
protected function getLateAliasService()
93+
{
94+
return $this->services['late_alias'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1();
95+
}
96+
97+
/**
98+
* Gets the private 'Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition' shared service.
99+
*
100+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition
101+
*/
102+
protected function getCustomDefinitionService()
103+
{
104+
return $this->privates['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
105+
}
106+
}

0 commit comments

Comments
 (0)
0