Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #27366 [DI] never inline lazy services (nicolas-grekas)
This PR was merged into the 2.8 branch. Discussion ---------- [DI] never inline lazy services | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | - | License | MIT | Doc PR | - Should apply also: - to deprecated services since 2.8 - to errored services since 3.4 Commits ------- 3b4d7ab [DI] never inline lazy services
- Loading branch information
Showing
4 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\DependencyInjection\Container; | ||
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; | ||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; | ||
use Symfony\Component\DependencyInjection\Exception\LogicException; | ||
use Symfony\Component\DependencyInjection\Exception\RuntimeException; | ||
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; | ||
|
||
/** | ||
* This class has been auto-generated | ||
* by the Symfony Dependency Injection Component. | ||
*/ | ||
class ProjectServiceContainer extends Container | ||
{ | ||
private $parameters; | ||
private $targetDirs = array(); | ||
|
||
public function __construct() | ||
{ | ||
$this->services = | ||
$this->scopedServices = | ||
$this->scopeStacks = array(); | ||
$this->scopes = array(); | ||
$this->scopeChildren = array(); | ||
$this->methodMap = array( | ||
'bar' => 'getBarService', | ||
'foo' => 'getFooService', | ||
); | ||
|
||
$this->aliases = array(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function compile() | ||
{ | ||
throw new LogicException('You cannot compile a dumped frozen container.'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isFrozen() | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Gets the public 'bar' shared service. | ||
* | ||
* @return \stdClass | ||
*/ | ||
protected function getBarService() | ||
{ | ||
return $this->services['bar'] = new \stdClass($this->get('foo')); | ||
} | ||
|
||
/** | ||
* Gets the public 'foo' service. | ||
* | ||
* @return \stdClass | ||
*/ | ||
public function getFooService($lazyLoad = true) | ||
{ | ||
// lazy factory | ||
|
||
return new \stdClass(); | ||
} | ||
} | ||
|
||
// proxy code |