Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf20260

Browse filesBrowse files
Merge branch '2.8' into 3.4
* 2.8: Add code of Conduct links in our README [DI] never inline lazy services Default testsuite to latest PHPUnit 6.* [Github] Update the pull-request template bumped Symfony version to 2.8.42 updated VERSION for 2.8.41 updated CHANGELOG for 2.8.41
2 parents 79bd461 + 4279f53 commit bf20260
Copy full SHA for bf20260

File tree

Expand file treeCollapse file tree

7 files changed

+119
-8
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+119
-8
lines changed

‎.github/PULL_REQUEST_TEMPLATE.md

Copy file name to clipboardExpand all lines: .github/PULL_REQUEST_TEMPLATE.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | master for features / 2.7 up to 4.0 for bug fixes <!-- see below -->
3+
| Branch? | master for features / 2.8 up to 4.1 for bug fixes <!-- see below -->
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- don't forget to update src/**/CHANGELOG.md files -->
66
| BC breaks? | no <!-- see https://symfony.com/bc -->

‎README.md

Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Community
2929
* [Join the Symfony Community][11] and meet other members at the [Symfony events][12].
3030
* [Get Symfony support][13] on Stack Overflow, Slack, IRC, etc.
3131
* Follow us on [GitHub][14], [Twitter][15] and [Facebook][16].
32+
* Read our [Code of Conduct][24] and meet the [CARE Team][25]
3233

3334
Contributing
3435
------------
@@ -71,3 +72,5 @@ Symfony development is sponsored by [SensioLabs][21], led by the
7172
[21]: https://sensiolabs.com
7273
[22]: https://symfony.com/doc/current/contributing/code/core_team.html
7374
[23]: https://github.com/symfony/symfony-demo
75+
[24]: https://symfony.com/coc
76+
[25]: https://symfony.com/doc/current/contributing/code_of_conduct/care_team.html

‎phpunit

Copy file name to clipboardExpand all lines: phpunit
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
88
exit(1);
99
}
1010
if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
11-
putenv('SYMFONY_PHPUNIT_VERSION=6.0');
11+
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
1212
}
1313
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
1414
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

‎src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ protected function processValue($value, $isRoot = false)
106106
*/
107107
private function isInlineableDefinition($id, Definition $definition, ServiceReferenceGraph $graph)
108108
{
109+
if ($definition->getErrors() || $definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic()) {
110+
return false;
111+
}
112+
109113
if (!$definition->isShared()) {
110114
return true;
111115
}
112116

113-
if ($definition->isDeprecated() || $definition->isPublic() || $definition->isPrivate() || $definition->isLazy()) {
117+
if ($definition->isPublic() || $definition->isPrivate()) {
114118
return false;
115119
}
116120

‎src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+14-2Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

14-
use DummyProxyDumper;
1514
use PHPUnit\Framework\TestCase;
1615
use Psr\Container\ContainerInterface;
1716
use Symfony\Component\Config\FileLocator;
@@ -490,6 +489,19 @@ public function testInlinedDefinitionReferencingServiceContainer()
490489
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
491490
}
492491

492+
public function testNonSharedLazyDefinitionReferences()
493+
{
494+
$container = new ContainerBuilder();
495+
$container->register('foo', 'stdClass')->setShared(false)->setLazy(true);
496+
$container->register('bar', 'stdClass')->addArgument(new Reference('foo', ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, false));
497+
$container->compile();
498+
499+
$dumper = new PhpDumper($container);
500+
$dumper->setProxyDumper(new \DummyProxyDumper());
501+
502+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_non_shared_lazy.php', $dumper->dump());
503+
}
504+
493505
public function testInitializePropertiesBeforeMethodCalls()
494506
{
495507
require_once self::$fixturesPath.'/includes/classes.php';
@@ -558,7 +570,7 @@ public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServic
558570

559571
$dumper = new PhpDumper($container);
560572

561-
$dumper->setProxyDumper(new DummyProxyDumper());
573+
$dumper->setProxyDumper(new \DummyProxyDumper());
562574
$dumper->dump();
563575

564576
$this->addToAssertionCount(1);

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ class DummyProxyDumper implements ProxyDumper
8585
{
8686
public function isProxyCandidate(Definition $definition)
8787
{
88-
return false;
88+
return $definition->isLazy();
8989
}
9090

9191
public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null)
9292
{
93-
return '';
93+
return " // lazy factory\n\n";
9494
}
9595

9696
public function getProxyCode(Definition $definition)
9797
{
98-
return '';
98+
return "// proxy code\n";
9999
}
100100
}
101101

+92Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
11+
/**
12+
* This class has been auto-generated
13+
* by the Symfony Dependency Injection Component.
14+
*
15+
* @final since Symfony 3.3
16+
*/
17+
class ProjectServiceContainer extends Container
18+
{
19+
private $parameters;
20+
private $targetDirs = array();
21+
22+
public function __construct()
23+
{
24+
$this->services = array();
25+
$this->methodMap = array(
26+
'bar' => 'getBarService',
27+
'foo' => 'getFooService',
28+
);
29+
$this->privates = array(
30+
'bar' => true,
31+
'foo' => true,
32+
);
33+
34+
$this->aliases = array();
35+
}
36+
37+
public function getRemovedIds()
38+
{
39+
return array(
40+
'Psr\\Container\\ContainerInterface' => true,
41+
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
42+
'bar' => true,
43+
'foo' => true,
44+
);
45+
}
46+
47+
public function compile()
48+
{
49+
throw new LogicException('You cannot compile a dumped container that was already compiled.');
50+
}
51+
52+
public function isCompiled()
53+
{
54+
return true;
55+
}
56+
57+
public function isFrozen()
58+
{
59+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED);
60+
61+
return true;
62+
}
63+
64+
protected function createProxy($class, \Closure $factory)
65+
{
66+
return $factory();
67+
}
68+
69+
/**
70+
* Gets the private 'bar' shared service.
71+
*
72+
* @return \stdClass
73+
*/
74+
protected function getBarService()
75+
{
76+
return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'});
77+
}
78+
79+
/**
80+
* Gets the private 'foo' service.
81+
*
82+
* @return \stdClass
83+
*/
84+
protected function getFooService($lazyLoad = true)
85+
{
86+
// lazy factory
87+
88+
return new \stdClass();
89+
}
90+
}
91+
92+
// proxy code

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.