-
Definitions and aliases will be made private by default in 4.0. You should either use service injection or explicitly define your services as public if you really need to inject the container.
-
Relying on service auto-registration while autowiring is deprecated and won't be supported in Symfony 4.0. Explicitly inject your dependencies or create services whose ids are their fully-qualified class name.
Before:
namespace App\Controller; use App\Mailer; class DefaultController { public function __construct(Mailer $mailer) { // ... } // ... }
services: App\Controller\DefaultController: autowire: true
After:
// same PHP codeservices: App\Controller\DefaultController: autowire: true # or # App\Controller\DefaultController: # arguments: { $mailer: "@App\Mailer" } App\Mailer: autowire: true
-
Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.
-
Case insensitivity of parameter names is deprecated and will be removed in 4.0.
-
The
ResolveDefinitionTemplatesPassclass is deprecated and will be removed in 4.0. Use theResolveChildDefinitionsPassclass instead.
- Support for stacked errors in the
ErrorHandleris deprecated and will be removed in Symfony 4.0.
- Deprecated
Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandlerandSymfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandlerSchema. UseSymfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandlerinstead.
- Implementing
TraceableEventDispatcherInterfacewithout thereset()method is deprecated and will be unsupported in 4.0.
- The
Symfony\Component\Filesystem\LockHandlerclass has been deprecated, use theSymfony\Component\Lock\Store\FlockStoreclass or theSymfony\Component\Lock\Store\FlockStore\SemaphoreStoreclass directly instead. - Support for passing relative paths to
Filesystem::makePathRelative()is deprecated and will be removed in 4.0.
- The
Symfony\Component\Finder\Iterator\FilterIteratorclass has been deprecated and will be removed in 4.0 as it used to fix a bug which existed before version 5.5.23/5.6.7.
-
Deprecated
ChoiceLoaderInterfaceimplementation inTimezoneType. Use the "choice_loader" option instead.Before:
class MyTimezoneType extends TimezoneType { public function loadChoices() { // override the method } }
After:
class MyTimezoneType extends AbstractType { public function. getParent() { return TimezoneType::class; } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefault('choice_loader', ...); // override the option instead } }
-
The
cache:clearcommand doesn't clear "app" PSR-6 cache pools anymore, but still clears "system" ones. Use thecache:pool:clearcommand to clear "app" pools instead. -
The
doctrine/cachedependency has been removed; require it viacomposer require doctrine/cacheif you are using Doctrine cache in your project. -
The
validator.mapping.cache.doctrine.apcservice has been deprecated. -
The
symfony/stopwatchdependency has been removed, require it viacomposer require symfony/stopwatchin yourdevenvironment. -
Using the
KERNEL_DIRenvironment variable or the automatic guessing based on thephpunit.xml/phpunit.xml.distfile location is deprecated since 3.4. Set theKERNEL_CLASSenvironment variable to the fully-qualified class name of your Kernel instead. Not setting theKERNEL_CLASSenvironment variable will throw an exception on 4.0 unless you override theKernelTestCase::createKernel()orKernelTestCase::getKernelClass()method. -
The
KernelTestCase::getPhpUnitXmlDir()andKernelTestCase::getPhpUnitCliConfigArgument()methods are deprecated since 3.4 and will be removed in 4.0. -
The
--no-prefixoption of thetranslation:updatecommand is deprecated and will be removed in 4.0. Use the--prefixoption with an empty string as value instead (e.g.--prefix="") -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPassclass has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPassclass has been deprecated and will be removed in 4.0. Use tagged iterator arguments instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPassclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\DependencyInjection\TranslationDumperPassclass instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPassclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\DependencyInjection\TranslationExtractorPassclass instead. -
The
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPassclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\DependencyInjection\TranslatorPassclass instead. -
The
Symfony\Bundle\FrameworkBundle\Translation\TranslationLoaderclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Reader\TranslationReaderclass instead. -
The
translation.loaderservice has been deprecated and will be removed in 4.0. Use thetranslation.readerservice instead.. -
AssetsInstallCommand::__construct()now takes an instance ofSymfony\Component\Filesystem\Filesystemas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
CacheClearCommand::__construct()now takes an instance ofSymfony\Component\HttpKernel\CacheClearer\CacheClearerInterfaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
CachePoolClearCommand::__construct()now takes an instance ofSymfony\Component\HttpKernel\CacheClearer\Psr6CacheCleareras first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
EventDispatcherDebugCommand::__construct()now takes an instance ofSymfony\Component\EventDispatcher\EventDispatcherInterfaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
RouterDebugCommand::__construct()now takes an instance ofSymfony\Component\Routing\RouterIntefaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
RouterMatchCommand::__construct()now takes an instance ofSymfony\Component\Routing\RouterIntefaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
TranslationDebugCommand::__construct()now takes an instance ofSymfony\Component\Translation\TranslatorInterfaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
TranslationUpdateCommand::__construct()now takes an instance ofSymfony\Component\Translation\TranslatorInterfaceas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
AssetsInstallCommand,CacheClearCommand,CachePoolClearCommand,EventDispatcherDebugCommand,RouterDebugCommand,RouterMatchCommand,TranslationDebugCommand,TranslationUpdateCommand,XliffLintCommandandYamlLintCommandclasses have been marked as final -
The
Symfony\Bundle\FrameworkBundle\Translation\PhpExtractorclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Extractor\PhpExtractorclass instead. -
The
Symfony\Bundle\FrameworkBundle\Translation\PhpStringTokenParserclass has been deprecated and will be removed in 4.0. Use theSymfony\Component\Translation\Extractor\PhpStringTokenParserclass instead.
-
The
Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandlerclass has been deprecated and will be removed in 4.0. Use the\SessionHandlerclass instead. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxyclass has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterfaceimplementation directly. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxyclass has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterfaceimplementation directly. -
The
Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxyclass has been deprecated and will be removed in 4.0. Use your\SessionHandlerInterfaceimplementation directly. -
NativeSessionStorage::setSaveHandler()now takes an instance of\SessionHandlerInterfaceas argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
Using
Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandlerwith the legacy mongo extension has been deprecated and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead. -
The
Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandlerclass has been deprecated and will be removed in 4.0. UseSymfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandlerinstead.
-
Bundle inheritance has been deprecated.
-
Relying on convention-based commands discovery has been deprecated and won't be supported in 4.0. Use PSR-4 based service discovery instead.
Before:
# app/config/services.yml services: # ... # implicit registration of all commands in the `Command` folder
After:
# app/config/services.yml services: # ... # explicit commands registration AppBundle\Command: resource: '../../src/AppBundle/Command/*' tags: ['console.command']
-
The
getCacheDir()method of your kernel should not be called while building the container. Use the%kernel.cache_dir%parameter instead. Not doing so may break thecache:clearcommand. -
The
Symfony\Component\HttpKernel\Config\EnvParametersResourceclass has been deprecated and will be removed in 4.0. -
Implementing
DataCollectorInterfacewithout areset()method has been deprecated and will be unsupported in 4.0. -
Implementing
DebugLoggerInterfacewithout aclear()method has been deprecated and will be unsupported in 4.0. -
The
ChainCacheClearer::add()method has been deprecated and will be removed in 4.0, inject the list of clearers as a constructor argument instead. -
The
CacheWarmerAggregate::add()andsetWarmers()methods have been deprecated and will be removed in 4.0, inject the list of clearers as a constructor argument instead. -
The
CacheWarmerAggregateandChainCacheClearerclasses have been made final.
-
The
Symfony\Component\Process\ProcessBuilderclass has been deprecated, use theSymfony\Component\Process\Processclass directly instead. -
Calling
Process::start()without setting a valid working directory (viasetWorkingDirectory()or constructor) beforehand is deprecated and will throw an exception in 4.0.
- The
profiler.matcheroption has been deprecated.
-
Deprecated the HTTP digest authentication:
NonceExpiredException,DigestAuthenticationListenerandDigestAuthenticationEntryPointwill be removed in 4.0. Use another authentication system likehttp_basicinstead. -
The
GuardAuthenticatorInterfacehas been deprecated and will be removed in 4.0. UseAuthenticatorInterfaceinstead.
-
Using voters that do not implement the
VoterInterfaceis now deprecated in theAccessDecisionManagerand this functionality will be removed in 4.0. -
FirewallContext::getListeners()now returns\Traversable|array -
InitAclCommand::__construct()now takes an instance ofDoctrine\DBAL\Connectionas first argument. Not passing it is deprecated and will throw aTypeErrorin 4.0. -
The
acl:setcommand has been deprecated along with theSetAclCommandclass, both will be removed in 4.0. Install symfony/acl-bundle instead -
The
init:aclcommand has been deprecated along with theInitAclCommandclass, both will be removed in 4.0. Install symfony/acl-bundle and useacl:initinstead -
Added
logout_on_user_changeto the firewall options. This config item will trigger a logout when the user has changed. Should be set to true to avoid deprecations in the configuration. -
Deprecated the HTTP digest authentication:
HttpDigestFactorywill be removed in 4.0. Use another authentication system likehttp_basicinstead. -
Deprecated setting the
switch_user.statelessoption to false when the firewall isstateless. Setting it to false will have no effect in 4.0. -
Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider. Using the first configured provider is deprecated since 3.4 and will throw an exception on 4.0. Explicitly configure the provider to use on your firewalls.
-
Symfony\Component\Translation\Writer\TranslationWriter::writeTranslationshas been deprecated and will be removed in 4.0, useSymfony\Component\Translation\Writer\TranslationWriter::writeinstead. -
Passing a
Symfony\Component\Translation\MessageSelectortoTranslatorhas been deprecated. You should pass a message formatter insteadBefore:
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\MessageSelector; $translator = new Translator('fr_FR', new MessageSelector());
After:
use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Formatter\MessageFormatter; $translator = new Translator('fr_FR', new MessageFormatter());
-
deprecated the
Symfony\Bridge\Twig\Form\TwigRendererclass, use theFormRendererclass from the Form component instead -
deprecated
Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironmentand the ability to pass a command name as first argument -
deprecated
Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironmentand the ability to pass a command name as first argument
-
deprecated the
Symfony\Bundle\TwigBundle\Command\DebugCommandclass, use theDebugCommandclass from the Twig bridge instead -
deprecated relying on the
ContainerAwareInterfaceimplementation forSymfony\Bundle\TwigBundle\Command\LintCommand
- Not setting the
strictoption of theChoiceconstraint totrueis deprecated and will throw an exception in Symfony 4.0.
-
the
Dumper,Parser, andYamlclasses are marked as final -
using the
!php/object:tag is deprecated and won't be supported in 4.0. Use the!php/objecttag (without the colon) instead. -
using the
!php/const:tag is deprecated and won't be supported in 4.0. Use the!php/consttag (without the colon) instead.Before:
!php/const:PHP_INT_MAXAfter:
!php/const PHP_INT_MAX -
Support for the
!strtag is deprecated, use the!!strtag instead. -
Using the non-specific tag
!is deprecated and will have a different behavior in 4.0. Use a plain integer or!!floatinstead. -
Using the
Yaml::PARSE_KEYS_AS_STRINGSflag is deprecated as it will be removed in 4.0.Before:
$yaml = <<<YAML null: null key true: boolean true 2.0: float key YAML; Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
After:
$yaml = <<<YAML "null": null key "true": boolean true "2.0": float key YAML; Yaml::parse($yaml);