You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+49-5Lines changed: 49 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,50 @@ Debug
77
77
DependencyInjection
78
78
-------------------
79
79
80
+
* Autowiring service auto-registration is not supported anymore.
81
+
Explicitly inject your dependencies or create services whose ids are
82
+
their fully-qualified class name.
83
+
84
+
Before:
85
+
86
+
```php
87
+
namespace App\Controller;
88
+
89
+
use App\Mailer;
90
+
91
+
class DefaultController
92
+
{
93
+
public function __construct(Mailer $mailer) {
94
+
// ...
95
+
}
96
+
97
+
// ...
98
+
}
99
+
```
100
+
```yml
101
+
services:
102
+
App\Controller\DefaultController:
103
+
autowire: true
104
+
```
105
+
106
+
After:
107
+
108
+
```php
109
+
// same PHP code
110
+
```
111
+
```yml
112
+
services:
113
+
App\Controller\DefaultController:
114
+
autowire: true
115
+
116
+
# or
117
+
# App\Controller\DefaultController:
118
+
# arguments: { $mailer: "@App\Mailer" }
119
+
120
+
App\Mailer:
121
+
autowire: true
122
+
```
123
+
80
124
* Autowiring services based on the types they implement is not supported anymore. Rename (or alias) your services to their FQCN id to make them autowirable.
81
125
82
126
* `_defaults` and `_instanceof` are now reserved service names in Yaml configurations. Please rename any services with that names.
@@ -338,9 +382,9 @@ FrameworkBundle
338
382
class instead.
339
383
340
384
* Using the `KERNEL_DIR` environment variable and the automatic guessing based
341
-
on the `phpunit.xml` file location have been removed from the `KernelTestCase::getKernelClass()`
385
+
on the `phpunit.xml` file location have been removed from the `KernelTestCase::getKernelClass()`
342
386
method implementation. Set the `KERNEL_CLASS` environment variable to the
343
-
fully-qualified class name of your Kernel or override the `KernelTestCase::createKernel()`
387
+
fully-qualified class name of your Kernel or override the `KernelTestCase::createKernel()`
344
388
or `KernelTestCase::getKernelClass()` method instead.
345
389
346
390
* The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` class has been removed.
@@ -349,10 +393,10 @@ FrameworkBundle
349
393
* The `--no-prefix` option of the `translation:update` command has
350
394
been removed.
351
395
352
-
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass` class has been removed.
396
+
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass` class has been removed.
353
397
Use the `Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass` class instead.
354
398
355
-
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass` class has been removed.
399
+
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass` class has been removed.
356
400
Use the `Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass` class instead.
357
401
358
402
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass`
@@ -554,7 +598,7 @@ TwigBridge
554
598
* The `TwigRendererEngine::setEnvironment()` method has been removed.
555
599
Pass the Twig Environment as second argument of the constructor instead.
556
600
557
-
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
601
+
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
558
602
to pass a command name as first argument.
559
603
560
604
* Removed `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability
Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -477,6 +477,8 @@ private function createAutowiredDefinition($type)
477
477
$this->currentId = $currentId;
478
478
}
479
479
480
+
@trigger_error(sprintf('Using autowiring service auto-registration for type "%s" is deprecated since version 3.4 and won\'t be supported in 4.0. Create a service named "%s" instead.', $type, $type), E_USER_DEPRECATED);
481
+
480
482
$this->container->log($this, sprintf('Type "%s" has been auto-registered for service "%s".', $type, $this->currentId));
* @expectedDeprecation Using autowiring service auto-registration for type "Symfony\Component\DependencyInjection\Tests\Compiler\Lille" is deprecated since version 3.4 and won't be supported in 4.0. Create a service named "Symfony\Component\DependencyInjection\Tests\Compiler\Lille" instead.
293
+
* @expectedDeprecation Using autowiring service auto-registration for type "Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas" is deprecated since version 3.4 and won't be supported in 4.0. Create a service named "Symfony\Component\DependencyInjection\Tests\Compiler\Dunglas" instead.
294
+
*/
290
295
publicfunctiontestCreateDefinition()
291
296
{
292
297
$container = newContainerBuilder();
@@ -368,6 +373,8 @@ public function testClassNotFoundThrowsException()
@@ -595,6 +604,10 @@ public function testExplicitMethodInjection()
595
604
);
596
605
}
597
606
607
+
/**
608
+
* @group legacy
609
+
* @expectedDeprecation Using autowiring service auto-registration for type "Symfony\Component\DependencyInjection\Tests\Compiler\A" is deprecated since version 3.4 and won't be supported in 4.0. Create a service named "Symfony\Component\DependencyInjection\Tests\Compiler\A" instead.
610
+
*/
598
611
publicfunctiontestTypedReference()
599
612
{
600
613
$container = newContainerBuilder();
@@ -653,6 +666,8 @@ public function testIgnoreServiceWithClassNotExisting()
@@ -87,23 +87,23 @@ protected function getSymfony_Component_DependencyInjection_Tests_Fixtures_TestS
87
87
protectedfunctiongetFooServiceService()
88
88
{
89
89
return$this->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(new \Symfony\Component\DependencyInjection\ServiceLocator(array('Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => function () {
return$this->services['autowired.Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
107
+
return$this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
0 commit comments