- Removed
Client, useAbstractBrowserinstead - Removed the possibility to extend
Responseby making it final. - Removed
Response::buildHeader() - Removed
Response::getStatus(), useResponse::getStatusCode()instead - The
Client::submit()method has a new$serverParametersargument.
- Removed
CacheItem::getPreviousTags(), useCacheItem::getMetadata()instead. - Removed all PSR-16 adapters, use
Psr16CacheorSymfony\Contracts\Cache\CacheInterfaceimplementations instead. - Removed
SimpleCacheAdapter, usePsr16Adapterinstead. - Added argument
$prefixtoAdapterInterface::clear()
- Dropped support for constructing a
TreeBuilderwithout passing root node information. - Added the
getChildNodeDefinitions()method toParentNodeDefinitionInterface. - The
Processorclass has been made final - Removed
FileLoaderLoadException, useLoaderLoadExceptioninstead. - Using environment variables with
cannotBeEmpty()if the value is validated withvalidate()will throw an exception. - Removed the
root()method inTreeBuilder, pass the root node information to the constructor instead - The
FilerLoader::import()method has a new$excludeargument.
-
Removed support for finding hidden commands using an abbreviation, use the full name instead
-
Removed the
setCrossingChar()method in favor of thesetDefaultCrossingChar()method inTableStyle. -
Removed the
setHorizontalBorderChar()method in favor of thesetDefaultCrossingChars()method inTableStyle. -
Removed the
getHorizontalBorderChar()method in favor of thegetBorderChars()method inTableStyle. -
Removed the
setVerticalBorderChar()method in favor of thesetVerticalBorderChars()method inTableStyle. -
Removed the
getVerticalBorderChar()method in favor of thegetBorderChars()method inTableStyle. -
Removed support for returning
nullfromCommand::execute(), return0instead -
Renamed
Application::renderException()andApplication::doRenderException()torenderThrowable()anddoRenderThrowable()respectively. -
The
ProcessHelper::run()method takes the command as an array of arguments.Before:
$processHelper->run($output, 'ls -l');
After:
$processHelper->run($output, array('ls', '-l')); // alternatively, when a shell wrapper is required $processHelper->run($output, Process::fromShellCommandline('ls -l'));
- Removed the component in favor of the
ErrorHandlercomponent - Replace uses of
Symfony\Component\Debug\DebugbySymfony\Component\ErrorHandler\Debug
-
Removed the
TypedReference::canBeAutoregistered()andTypedReference::getRequiringClass()methods. -
Removed support for auto-discovered extension configuration class which does not implement
ConfigurationInterface. -
Removed support for non-string default env() parameters
Before:
parameters: env(NAME): 1.5
After:
parameters: env(NAME): '1.5'
-
Removed support for short factories and short configurators in Yaml
Before:
services: my_service: factory: factory_service:method
After:
services: my_service: factory: ['@factory_service', method]
- Removed the possibility to inject
ClassMetadataFactoryinDoctrineExtractor, an instance ofEntityManagerInterfaceshould be injected instead - Passing an
IdReaderto theDoctrineChoiceLoaderwhen the query cannot be optimized with single id field will throw an exception, passnullinstead - Not passing an
IdReaderto theDoctrineChoiceLoaderwhen the query can be optimized with single id field will not apply any optimization - The
RegistryInterfacehas been removed. - Added a new
getMetadataDriverClassmethod inAbstractDoctrineExtensionto replace class parameters.
- The
Crawler::children()method has a new$selectorargument.
- First parameter
$usePutenvofDotenv::__construct()now default tofalse.
- The
TraceableEventDispatcherInterfacehas been removed. - The signature of the
EventDispatcherInterface::dispatch()method has been updated todispatch($event, string $eventName = null) - The
Eventclass has been removed, useSymfony\Contracts\EventDispatcher\Eventinstead
- The
Filesystem::isAbsolutePath()method no longer supportsnullin the$fileargument. - The
Filesystem::dumpFile()method no longer supports arrays in the$contentargument. - The
Filesystem::appendToFile()method no longer supports arrays in the$contentargument.
- The
Finder::sortByName()method has a new$useNaturalSortargument.
-
Removed support for using different values for the "model_timezone" and "view_timezone" options of the
TimeTypewithout configuring a reference date. -
Removed support for using
intorfloatas data for theNumberTypewhen theinputoption is set tostring. -
Removed support for using the
formatoption ofDateTypeandDateTimeTypewhen thehtml5option is enabled. -
Using names for buttons that do not start with a letter, a digit, or an underscore leads to an exception.
-
Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons leads to an exception.
-
Using the
date_format,date_widget, andtime_widgetoptions of theDateTimeTypewhen thewidgetoption is set tosingle_textis not supported anymore. -
The
getExtendedType()method was removed from theFormTypeExtensionInterface. It is replaced by the the staticgetExtendedTypes()method which must return an iterable of extended types.Before:
class FooTypeExtension extends AbstractTypeExtension { public function getExtendedType() { return FormType::class; } // ... }
After:
class FooTypeExtension extends AbstractTypeExtension { public static function getExtendedTypes(): iterable { return array(FormType::class); } // ... }
-
The
scaleoption was removed from theIntegerType. -
The
$scaleargument of theIntegerToLocalizedStringTransformerwas removed. -
Calling
FormRenderer::searchAndRenderBlockfor fields which were already rendered throws an exception instead of returning empty strings:Before:
{% for field in fieldsWithPotentialDuplicates %} {{ form_widget(field) }} {% endfor %}After:
{% for field in fieldsWithPotentialDuplicates if not field.rendered %} {{ form_widget(field) }} {% endfor %} -
The
regionsoption was removed from theTimezoneType. -
Added support for PHPUnit 8. A
voidreturn-type was added to theFormIntegrationTestCase::setUp(),TypeTestCase::setUp()andTypeTestCase::tearDown()methods.
-
Calling
WebTestCase::createClient()while a kernel has been booted now throws an exception, ensure the kernel is shut down before calling the method -
Removed the
framework.templatingoption, configure the Twig bundle instead. -
The project dir argument of the constructor of
AssetsInstallCommandis required. -
Removed support for
bundle:controller:actionsyntax to reference controllers. UseserviceOrFqcn::methodinstead whereserviceOrFqcnis either the service ID when using controllers as services or the FQCN of the controller.Before:
bundle_controller: path: / defaults: _controller: FrameworkBundle:Redirect:redirect
After:
bundle_controller: path: / defaults: _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
-
Removed
Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser. -
Warming up a router in
RouterCacheWarmerthat does not implement theWarmableInterfaceis not supported anymore. -
The
RequestDataCollectorclass has been removed. Use theSymfony\Component\HttpKernel\DataCollector\RequestDataCollectorclass instead. -
Removed
Symfony\Bundle\FrameworkBundle\Controller\Controller. UseSymfony\Bundle\FrameworkBundle\Controller\AbstractControllerinstead. -
Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (
framework.session.cookie_samesite) tolaxfor increased security against CSRF attacks. -
The
ContainerAwareCommandclass has been removed, useSymfony\Component\Console\Command\Commandwith dependency injection instead. -
The
Templating\Helper\TranslatorHelper::transChoice()method has been removed, use thetrans()one instead with a%count%parameter. -
Removed support for legacy translations directories
src/Resources/translations/andsrc/Resources/<BundleName>/translations/, usetranslations/instead. -
Support for the legacy directory structure in
translation:updateanddebug:translationcommands has been removed. -
Removed the
Psr\SimpleCache\CacheInterface/cache.app.simpleservice, useSymfony\Contracts\Cache\CacheInterface/cache.appinstead. -
Removed support for
templatingengine inTemplateController, use Twig instead -
Removed
ResolveControllerNameSubscriber. -
Removed
routing.loader.service. -
Added support for PHPUnit 8. A
voidreturn-type was added to theKernelTestCase::tearDown()andWebTestCase::tearDown()method. -
Removed the
lock.store.flock,lock.store.semaphore,lock.store.memcached.abstractandlock.store.redis.abstractservices. -
Removed the
router.cache_class_prefixparameter.
- Added method
cancel()toResponseInterface - The
$parserargument ofControllerResolver::__construct()andDelegatingLoader::__construct()has been removed. - The
ControllerResolverandDelegatingLoaderclasses have been madefinal. - The
controller_name_converterandresolve_controller_name_subscriberservices have been removed.
- The
$sizeargument of theUploadedFileconstructor has been removed. - The
getClientSize()method of theUploadedFileclass has been removed. - The
getSession()method of theRequestclass throws an exception when session is null. - The default value of the
$secureand$samesitearguments of Cookie's constructor changed respectively from "false" to "null" and from "null" to "lax". - The
MimeTypeGuesserInterfaceandExtensionGuesserInterfaceinterfaces have been removed, useSymfony\Component\Mime\MimeTypesInterfaceinstead. - The
MimeTypeandMimeTypeExtensionGuesserclasses have been removed, useSymfony\Component\Mime\MimeTypesinstead. - The
FileBinaryMimeTypeGuesserclass has been removed, useSymfony\Component\Mime\FileBinaryMimeTypeGuesserinstead. - The
FileinfoMimeTypeGuesserclass has been removed, useSymfony\Component\Mime\FileinfoMimeTypeGuesserinstead. ApacheRequesthas been removed, use theRequestclass instead.- The third argument of the
HeaderBag::get()method has been removed, use methodall()instead. - Getting the container from a non-booted kernel is not possible anymore.
- [BC BREAK]
PdoSessionHandlerwith MySQL changed the type of the lifetime column, make sure to runALTER TABLE sessions MODIFY sess_lifetime INTEGER UNSIGNED NOT NULLto update your database.
-
Removed
Client, useHttpKernelBrowserinstead -
The
Kernel::getRootDir()and thekernel.root_dirparameter have been removed -
The
KernelInterface::getName()and thekernel.nameparameter have been removed -
Removed the first and second constructor argument of
ConfigDataCollector -
Removed
ConfigDataCollector::getApplicationName() -
Removed
ConfigDataCollector::getApplicationVersion() -
Removed
FilterControllerArgumentsEvent, useControllerArgumentsEventinstead -
Removed
FilterControllerEvent, useControllerEventinstead -
Removed
FilterResponseEvent, useResponseEventinstead -
Removed
GetResponseEvent, useRequestEventinstead -
Removed
GetResponseForControllerResultEvent, useViewEventinstead -
Removed
GetResponseForExceptionEvent, useExceptionEventinstead -
Removed
PostResponseEvent, useTerminateEventinstead -
Removed
TranslatorListenerin favor ofLocaleAwareListener -
The
DebugHandlersListenerclass has been madefinal -
Removed
SaveSessionListenerin favor ofAbstractSessionListener -
Removed methods
ExceptionEvent::get/setException(), useget/setThrowable()instead -
Removed class
ExceptionListener, useErrorListenerinstead -
Added new Bundle directory convention consistent with standard skeletons:
└── MyBundle/ ├── config/ ├── public/ ├── src/ │ └── MyBundle.php ├── templates/ └── translations/To make this work properly, it is necessary to change the root path of the bundle:
class MyBundle extends Bundle { public function getPath(): string { return \dirname(__DIR__); } }
As many bundles must be compatible with a range of Symfony versions, the current directory convention is not deprecated yet, but it will be in the future.
-
Removed the second and third argument of
KernelInterface::locateResource -
Removed the second and third argument of
FileLocator::__construct -
Removed loading resources from
%kernel.root_dir%/Resourcesand%kernel.root_dir%as fallback directories.
- Removed
ResourceBundlenamespace - Removed
Intl::getLanguageBundle(), useLanguagesorScriptsinstead - Removed
Intl::getCurrencyBundle(), useCurrenciesinstead - Removed
Intl::getLocaleBundle(), useLocalesinstead - Removed
Intl::getRegionBundle(), useCountriesinstead
- Removed
Symfony\Component\Lock\StoreInterfacein favor ofSymfony\Component\Lock\BlockingStoreInterfaceandSymfony\Component\Lock\PersistingStoreInterface. - Removed
Factory, useLockFactoryinstead
- The
LoggingMiddlewareclass has been removed, pass a logger toSendMessageMiddlewareinstead. - Passing a
ContainerInterfaceinstance as first argument of theConsumeMessagesCommandconstructor now throws as\TypeError, pass aRoutableMessageBusinstance instead.
- The methods
DebugProcessor::getLogs(),DebugProcessor::countErrors(),Logger::getLogs()andLogger::countErrors()have a new$requestargument.
- The
RouteProcessorclass is final.
-
Removed the
Process::inheritEnvironmentVariables()method: env variables are always inherited. -
Removed the
Process::setCommandline()and thePhpProcess::setPhpBinary()methods. -
Commands must be defined as arrays when creating a
Processinstance.Before:
$process = new Process('ls -l');
After:
$process = new Process(array('ls', '-l')); // alternatively, when a shell wrapper is required $process = Process::fromShellCommandline('ls -l');
- Removed support of passing
nullas 2nd argument ofPropertyAccessor::createCache()method ($defaultLifetime), pass0instead.
- The
generator_base_class,generator_cache_class,matcher_base_class, andmatcher_cache_classrouter options have been removed. If you are using multiple Router instances and need separate caches for them, set a uniquecache_dirper Router instance instead. Serializableimplementing methods forRouteandCompiledRouteare final. Instead of overwriting them, use__serializeand__unserializeas extension points which are forward compatible with the new serialization methods in PHP 7.4.- Removed
ServiceRouterLoaderandObjectRouteLoader. - Service route loaders must be tagged with
routing.route_loader. - The
RoutingConfigurator::import()method has a new optional$excludeargument.
-
Dropped support for passing more than one attribute to
AccessDecisionManager::decide()andAuthorizationChecker::isGranted()(and indirectly theis_granted()Twig and ExpressionLanguage function):Before
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) { // ... }
After
if ($this->authorizationChecker->isGranted(new Expression("is_granted('ROLE_USER') or is_granted('ROLE_ADMIN')"))) {} // or: if ($this->authorizationChecker->isGranted('ROLE_USER') || $this->authorizationChecker->isGranted('ROLE_ADMIN') ) {}
-
The
LdapUserProviderclass has been removed, useSymfony\Component\Ldap\Security\LdapUserProviderinstead. -
Implementations of
PasswordEncoderInterfaceandUserPasswordEncoderInterfacemust have a newneedsRehash()method -
The
RoleandSwitchUserRoleclasses have been removed. -
The
getReachableRoles()method of theRoleHierarchyclass has been removed. It has been replaced by the newgetReachableRoleNames()method. -
The
getRoles()method has been removed from theTokenInterface. It has been replaced by the newgetRoleNames()method. -
The
ContextListener::setLogoutOnUserChange()method has been removed. -
The
Symfony\Component\Security\Core\User\AdvancedUserInterfacehas been removed. -
The
ExpressionVoter::addExpressionLanguageProvider()method has been removed. -
The
FirewallMapInterface::getListeners()method must return an array of 3 elements, the 3rd one must be either aLogoutListenerinstance ornull. -
The
AuthenticationTrustResolverconstructor arguments have been removed. -
A user object that is not an instance of
UserInterfacecannot be accessed fromSecurity::getUser()anymore and returnsnullinstead. -
SimpleAuthenticatorInterface,SimpleFormAuthenticatorInterface,SimplePreAuthenticatorInterface,SimpleAuthenticationProvider,SimpleAuthenticationHandler,SimpleFormAuthenticationListenerandSimplePreAuthenticationListenerhave been removed. Use Guard instead. -
The
ListenerInterfacehas been removed, extendAbstractListenerinstead. -
The
Firewall::handleRequest()method has been removed, useFirewall::callListeners()instead. -
\Serializableinterface has been removed fromAbstractTokenandAuthenticationException, thusserialize()andunserialize()aren't available. Use__serialize()and__unserialize()instead.Before:
public function serialize() { return [$this->myLocalVar, parent::serialize()]; } public function unserialize($serialized) { [$this->myLocalVar, $parentSerialized] = unserialize($serialized); parent::unserialize($parentSerialized); }
After:
public function __serialize(): array { return [$this->myLocalVar, parent::__serialize()]; } public function __unserialize(array $data): void { [$this->myLocalVar, $parentData] = $data; parent::__unserialize($parentData); }
-
The
Argon2iPasswordEncoderclass has been removed, useSodiumPasswordEncoderinstead. -
The
BCryptPasswordEncoderclass has been removed, useNativePasswordEncoderinstead. -
Classes implementing the
TokenInterfacemust implement the two new methods__serializeand__unserialize -
Implementations of
Guard\AuthenticatorInterface::checkCredentials()must return a boolean value now. Please explicitly returnfalseto indicate invalid credentials. -
Removed the
has_role()function from security expressions, useis_granted()instead.
- The
logout_on_user_changefirewall option has been removed. - The
switch_user.statelessfirewall option has been removed. - The
SecurityUserValueResolverclass has been removed. - Passing a
FirewallConfiginstance as 3rd argument to theFirewallContextconstructor now throws a\TypeError, pass aLogoutListenerinstance instead. - The
security.authentication.trust_resolver.anonymous_classparameter has been removed. - The
security.authentication.trust_resolver.rememberme_classparameter has been removed. - The
simple_formandsimple_preauthauthentication listeners have been removed, use Guard instead. - The
SimpleFormFactoryandSimplePreAuthenticationFactoryclasses have been removed, use Guard instead. - The names of the cookies configured in the
logout.delete_cookiesoption are no longer normalized. If any of your cookie names has dashes they won't be changed to underscores. Before:my-cookiedeleted themy_cookiecookie (with an underscore). After:my-cookiedeletes themy-cookiecookie (with a dash). - Removed the
security.user.provider.in_memory.userservice.
-
The default value of the
CsvEncoder"as_collection" option was changed totrue. -
Individual encoders & normalizers options as constructor arguments were removed. Use the default context instead.
-
The following method and properties:
AbstractNormalizer::$circularReferenceLimitAbstractNormalizer::$circularReferenceHandlerAbstractNormalizer::$callbacksAbstractNormalizer::$ignoredAttributesAbstractNormalizer::$camelizedAttributesAbstractNormalizer::setCircularReferenceLimit()AbstractNormalizer::setCircularReferenceHandler()AbstractNormalizer::setCallbacks()AbstractNormalizer::setIgnoredAttributes()AbstractObjectNormalizer::$maxDepthHandlerAbstractObjectNormalizer::setMaxDepthHandler()XmlEncoder::setRootNodeName()XmlEncoder::getRootNodeName()
were removed, use the default context instead.
-
The
AbstractNormalizer::handleCircularReference()method has two new$formatand$contextarguments. -
Removed support for instantiating a
DataUriNormalizerwith a default MIME type guesser when thesymfony/mimecomponent isn't installed.
- Removed the
XmlEncoder::TYPE_CASE_ATTRIBUTESconstant. UseXmlEncoder::TYPE_CAST_ATTRIBUTESinstead.
- Removed support for passing
nullas 1st ($id) argument ofSection::get()method, pass a valid child section identifier instead.
- Support for using
nullas the locale inTranslatorhas been removed. - The
FileDumper::setBackup()method has been removed. - The
TranslationWriter::disableBackup()method has been removed. - The
TranslatorInterfacehas been removed in favor ofSymfony\Contracts\Translation\TranslatorInterface - The
MessageSelector,IntervalandPluralizationRulesclasses have been removed, useIdentityTranslatorinstead - The
Translator::getFallbackLocales()andTranslationDataCollector::getFallbackLocales()method are now internal - The
Translator::transChoice()method has been removed in favor of usingTranslator::trans()with "%count%" as the parameter driving plurals - Removed support for implicit STDIN usage in the
lint:xliffcommand, uselint:xliff -(append a dash) instead to make it explicit.
- The default value (
false) of thetwig.strict_variablesconfiguration option has been changed to%kernel.debug%. - The
transchoicetag and filter have been removed, use thetransones instead with a%count%parameter. - Removed support for legacy templates directories
src/Resources/views/andsrc/Resources/<BundleName>/views/, usetemplates/andtemplates/bundles/<BundleName>/instead. - The
twig.exception_controllerconfiguration option has been removed, useframework.error_controllerinstead. - Removed
ExceptionController,PreviewErrorControllerclasses and all built-in error templates
- Removed argument
$rootDirfrom theDebugCommand::__construct()method and the 5th argument must be an instance ofFileLinkFormatter - Removed the
$requestStackand$requestContextarguments of theHttpFoundationExtension, pass aSymfony\Component\HttpFoundation\UrlHelperinstance as the only argument instead - Removed support for implicit STDIN usage in the
lint:twigcommand, uselint:twig -(append a dash) instead to make it explicit.
- Removed support for non-string codes of a
ConstraintViolation. Astringtype-hint was added to the constructor of theConstraintViolationclass and to theConstraintViolationBuilder::setCode()method. - An
ExpressionLanguageinstance or null must be passed as the first argument ofExpressionValidator::__construct() - The
checkMXandcheckHostoptions of theEmailconstraint were removed - The
Email::__construct()'strict' property has been removed. Use 'mode'=>"strict" instead. - Calling
EmailValidator::__construct()method with a boolean parameter has been removed, useEmailValidator("strict")instead. - Removed the
checkDNSanddnsMessageoptions from theUrlconstraint. - The component is now decoupled from
symfony/translationand usesSymfony\Contracts\Translation\TranslatorInterfaceinstead - The
ValidatorBuilderInterfacehas been removed - Removed support for validating instances of
\DateTimeInterfaceinDateTimeValidator,DateValidatorandTimeValidator. UseTypeinstead or remove the constraint if the underlying model is type hinted to\DateTimeInterfacealready. - The
symfony/intlcomponent is now required for using theBic,Country,Currency,LanguageandLocaleconstraints - The
egulias/email-validatorcomponent is now required for using theEmailconstraint in strict mode - The
symfony/expression-languagecomponent is now required for using theExpressionconstraint - Changed the default value of
Length::$allowEmptyStringtofalseand made it optional - Added support for PHPUnit 8. A
voidreturn-type was added to theConstraintValidatorTestCase::setUp()andConstraintValidatorTestCase::tearDown()methods. - The
Symfony\Component\Validator\Mapping\Cache\CacheInterfaceand all its implementations have been removed. - The
ValidatorBuilder::setMetadataCachehas been removed, useValidatorBuilder::setMappingCacheinstead.
- Removed the
ExceptionController::templateExists()method - Removed the
TemplateManager::templateExists()method
-
The
DefinitionBuilder::reset()method has been removed, use theclear()one instead. -
addmethod has been removed useaddWorkflowmethod inWorkflow\Registryinstead. -
SupportStrategyInterfacehas been removed, useWorkflowSupportStrategyInterfaceinstead. -
ClassInstanceSupportStrategyhas been removed, useInstanceOfSupportStrategyinstead. -
WorkflowInterface::apply()has a third argument:array $context = []. -
MarkingStoreInterface::setMarking()has a third argument:array $context = []. -
Removed support of
initial_place. Useinitial_markinginstead. -
MultipleStateMarkingStorehas been removed. UseMethodMarkingStoreinstead. -
DefinitionBuilder::setInitialPlace()has been removed, useDefinitionBuilder::setInitialPlaces()instead.Before:
framework: workflows: type: workflow article: marking_store: type: multiple arguments: states
After:
framework: workflows: type: workflow article: marking_store: property: states
-
SingleStateMarkingStorehas been removed. UseMethodMarkingStoreinstead.Before:
framework: workflows: article: marking_store: arguments: state
After:
framework: workflows: article: marking_store: property: state
-
Support for using a workflow with a single state marking is dropped. Use a state machine instead.
Before:
framework: workflows: article: type: workflow marking_store: type: single_state
After:
framework: workflows: article: type: state_machine
- The parser is now stricter and will throw a
ParseExceptionwhen a mapping is found inside a multi-line string. - Removed support for implicit STDIN usage in the
lint:yamlcommand, uselint:yaml -(append a dash) instead to make it explicit.
- Removed the
ExceptionControllerclass, useExceptionErrorControllerinstead.
- The bundle has been deprecated and can be installed separately. You may also use the Symfony Local Web Server instead.