-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #28678 [DI] fix dumping setters before their inlined instances (n…
…icolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [DI] fix dumping setters before their inlined instances | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28654 | License | MIT | Doc PR | - Commits ------- d60eb1a [DI] fix dumping setters before their inlined instances
- Loading branch information
Showing
5 changed files
with
170 additions
and
1 deletion.
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
89 changes: 89 additions & 0 deletions
89
src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_tsantos.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,89 @@ | ||
<?php | ||
|
||
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\DependencyInjection\Container; | ||
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. | ||
* | ||
* @final since Symfony 3.3 | ||
*/ | ||
class ProjectServiceContainer extends Container | ||
{ | ||
private $parameters; | ||
private $targetDirs = array(); | ||
|
||
public function __construct() | ||
{ | ||
$this->services = array(); | ||
$this->normalizedIds = array( | ||
'tsantos\\serializer\\serializerinterface' => 'TSantos\\Serializer\\SerializerInterface', | ||
); | ||
$this->methodMap = array( | ||
'tsantos_serializer' => 'getTsantosSerializerService', | ||
); | ||
$this->aliases = array( | ||
'TSantos\\Serializer\\SerializerInterface' => 'tsantos_serializer', | ||
); | ||
} | ||
|
||
public function getRemovedIds() | ||
{ | ||
return array( | ||
'Psr\\Container\\ContainerInterface' => true, | ||
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, | ||
); | ||
} | ||
|
||
public function compile() | ||
{ | ||
throw new LogicException('You cannot compile a dumped container that was already compiled.'); | ||
} | ||
|
||
public function isCompiled() | ||
{ | ||
return true; | ||
} | ||
|
||
public function isFrozen() | ||
{ | ||
@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); | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Gets the public 'tsantos_serializer' shared service. | ||
* | ||
* @return \TSantos\Serializer\EventEmitterSerializer | ||
*/ | ||
protected function getTsantosSerializerService() | ||
{ | ||
$a = new \TSantos\Serializer\NormalizerRegistry(); | ||
|
||
$d = new \TSantos\Serializer\EventDispatcher\EventDispatcher(); | ||
$d->addSubscriber(new \TSantos\SerializerBundle\EventListener\StopwatchListener(new \Symfony\Component\Stopwatch\Stopwatch(true))); | ||
|
||
$this->services['tsantos_serializer'] = $instance = new \TSantos\Serializer\EventEmitterSerializer(new \TSantos\Serializer\Encoder\JsonEncoder(), $a, $d); | ||
|
||
$b = new \TSantos\Serializer\Normalizer\CollectionNormalizer(); | ||
|
||
$b->setSerializer($instance); | ||
|
||
$c = new \TSantos\Serializer\Normalizer\JsonNormalizer(); | ||
|
||
$c->setSerializer($instance); | ||
|
||
$a->add(new \TSantos\Serializer\Normalizer\ObjectNormalizer(new \TSantos\SerializerBundle\Serializer\CircularReferenceHandler())); | ||
$a->add($b); | ||
$a->add($c); | ||
|
||
return $instance; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_tsantos.xml
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,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<services> | ||
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true"/> | ||
<service id="tsantos_serializer" class="TSantos\Serializer\EventEmitterSerializer" public="true"> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\Encoder\JsonEncoder" public="false"> | ||
<tag name="tsantos_serializer.encoder" format="json"/> | ||
</service> | ||
</argument> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\NormalizerRegistry" public="false"> | ||
<call method="add"> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\Normalizer\ObjectNormalizer" public="false"> | ||
<tag name="tsantos_serializer.normalizer" priority="-800"/> | ||
<argument type="service"> | ||
<service class="TSantos\SerializerBundle\Serializer\CircularReferenceHandler" public="false"/> | ||
</argument> | ||
</service> | ||
</argument> | ||
</call> | ||
<call method="add"> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\Normalizer\CollectionNormalizer" public="false"> | ||
<tag name="tsantos_serializer.normalizer" priority="-900"/> | ||
<call method="setSerializer"> | ||
<argument type="service" id="tsantos_serializer"/> | ||
</call> | ||
</service> | ||
</argument> | ||
</call> | ||
<call method="add"> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\Normalizer\JsonNormalizer" public="false"> | ||
<tag name="tsantos_serializer.normalizer" priority="-1000"/> | ||
<call method="setSerializer"> | ||
<argument type="service" id="tsantos_serializer"/> | ||
</call> | ||
</service> | ||
</argument> | ||
</call> | ||
</service> | ||
</argument> | ||
<argument type="service"> | ||
<service class="TSantos\Serializer\EventDispatcher\EventDispatcher" public="false"> | ||
<call method="addSubscriber"> | ||
<argument type="service"> | ||
<service class="TSantos\SerializerBundle\EventListener\StopwatchListener" public="false"> | ||
<tag name="tsantos_serializer.event_subscriber"/> | ||
<argument type="service"> | ||
<service class="Symfony\Component\Stopwatch\Stopwatch" public="false"> | ||
<tag name="kernel.reset" method="reset"/> | ||
<argument>true</argument> | ||
</service> | ||
</argument> | ||
</service> | ||
</argument> | ||
</call> | ||
</service> | ||
</argument> | ||
</service> | ||
<service id="TSantos\Serializer\SerializerInterface" alias="tsantos_serializer" public="true"/> | ||
</services> | ||
</container> |
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