- The
Client::submit()
method will have a new$serverParameters
argument in version 5.0, not defining it is deprecated.
- Deprecated
CacheItem::getPreviousTags()
, useCacheItem::getMetadata()
instead.
- Deprecated constructing a
TreeBuilder
without passing root node information. - Deprecated
FileLoaderLoadException
, useLoaderLoadException
instead.
-
Deprecated passing a command as a string to
ProcessHelper::run()
, pass the command as an array of arguments instead.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'));
- The
lazy
attribute ondoctrine.event_listener
tags was removed. Listeners are now lazy by default. So anylazy
attributes can safely be removed from those tags.
- The
Crawler::children()
method will have a new$selector
argument in version 5.0, not defining it is deprecated.
- The
Finder::sortByName()
method will have a new$useNaturalSort
argument in version 5.0, not defining it is deprecated.
-
The
getExtendedType()
method of theFormTypeExtensionInterface
is deprecated and will be removed in 5.0. Type extensions must implement the staticgetExtendedTypes()
method instead and 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
scale
option of theIntegerType
is deprecated. -
The
$scale
argument of theIntegerToLocalizedStringTransformer
is deprecated. -
Deprecated calling
FormRenderer::searchAndRenderBlock
for fields which were already rendered. Instead of expecting such calls to return empty strings, check if the field has already been rendered.Before:
{% for field in fieldsWithPotentialDuplicates %} {{ form_widget(field) }} {% endfor %}
After:
{% for field in fieldsWithPotentialDuplicates if not field.rendered %} {{ form_widget(field) }} {% endfor %}
- The default value of the "$secure" and "$samesite" arguments of Cookie's constructor will respectively change from "false" to "null" and from "null" to "lax" in Symfony 5.0, you should define their values explicitly or use "Cookie::create()" instead.
-
The
framework.router.utf8
configuration option has been added. If your app's charset is UTF-8 (see kernel'sgetCharset()
method), it is recommended to set it totrue
: this will generate 404s for non-UTF-8 URLs, which are incompatible with you app anyway, and will allow dumping optimized routers and using Unicode classes in requirements. -
Added support for the SameSite attribute for session cookies. It is highly recommended to set this setting (
framework.session.cookie_samesite
) tolax
for increased security against CSRF attacks. -
The
Controller
class has been deprecated, useAbstractController
instead. -
The Messenger encoder/decoder configuration has been changed for a unified Messenger serializer configuration.
Before:
framework: messenger: encoder: your_encoder_service_id decoder: your_decoder_service_id
After:
framework: messenger: serializer: id: your_messenger_service_id
-
The
ContainerAwareCommand
class has been deprecated, useSymfony\Component\Console\Command\Command
with dependency injection instead. -
The
--env
console option and its "-e" shortcut have been deprecated, set the "APP_ENV" environment variable instead. -
The
--no-debug
console option has been deprecated, set the "APP_DEBUG" environment variable to "0" instead. -
The
Templating\Helper\TranslatorHelper::transChoice()
method has been deprecated, use thetrans()
one instead with a%count%
parameter.
-
EnvelopeItemInterface
doesn't extendSerializable
anymore -
The
handle
method of theSymfony\Component\Messenger\Middleware\ValidationMiddleware
andSymfony\Component\Messenger\Asynchronous\Middleware\SendMessageMiddleware
middlewares now requires anEnvelope
object to be given (because they implement theEnvelopeAwareInterface
). When using these middleware with the providedMessageBus
, you will not have to do anything. If you use the middlewares any other way, you can useEnvelope::wrap($message)
to create an envelope for your message. -
MessageSubscriberInterface::getHandledMessages()
return value has changed. The value of an array item needs to be an associative array or the method name.Before:
return [ [FirstMessage::class, 0], [SecondMessage::class, -10], ];
After:
yield FirstMessage::class => ['priority' => 0]; yield SecondMessage::class => ['priority => -10];
Before:
return [ SecondMessage::class => ['secondMessageMethod', 20], ];
After:
yield SecondMessage::class => [ 'method' => 'secondMessageMethod', 'priority' => 20, ];
-
The
EncoderInterface
andDecoderInterface
interfaces have been replaced by a unifiedSymfony\Component\Messenger\Transport\Serialization\SerializerInterface
. Each interface method have been merged untouched into theSerializer
interface, so you can simply merge your two implementations together and implement the new interface.
- The methods
DebugProcessor::getLogs()
,DebugProcessor::countErrors()
,Logger::getLogs()
andLogger::countErrors()
will have a new$request
argument in version 5.0, not defining it is deprecated.
-
Deprecated the
Process::setCommandline()
and thePhpProcess::setPhpBinary()
methods. -
Deprecated passing commands as strings when creating a
Process
instance.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');
- Using the
has_role()
function in security expressions is deprecated, use theis_granted()
function instead. - Not returning an array of 3 elements from
FirewallMapInterface::getListeners()
is deprecated, the 3rd element must be an instance ofLogoutListener
ornull
. - Passing custom class names to the
Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver
to define custom anonymous and remember me token classes is deprecated. To use custom tokens, extend the existingSymfony\Component\Security\Core\Authentication\Token\AnonymousToken
orSymfony\Component\Security\Core\Authentication\Token\RememberMeToken
. - Accessing the user object that is not an instance of
UserInterface
fromSecurity::getUser()
is deprecated. SimpleAuthenticatorInterface
,SimpleFormAuthenticatorInterface
,SimplePreAuthenticatorInterface
,SimpleAuthenticationProvider
,SimpleAuthenticationHandler
,SimpleFormAuthenticationListener
andSimplePreAuthenticationListener
have been deprecated. Use Guard instead.
- Passing a
FirewallConfig
instance as 3rd argument to theFirewallContext
constructor is deprecated, pass aLogoutListener
instance instead. - Using the
security.authentication.trust_resolver.anonymous_class
andsecurity.authentication.trust_resolver.rememberme_class
parameters to define the token classes is deprecated. To use custom tokens extend the existing AnonymousToken and RememberMeToken. - The
simple_form
andsimple_preauth
authentication listeners have been deprecated, use Guard instead. - The
SimpleFormFactory
andSimplePreAuthenticationFactory
classes have been deprecated, use Guard instead.
- Relying on the default value (false) of the "as_collection" option is deprecated. You should set it to false explicitly instead as true will be the default value in 5.0.
- The
AbstractNormalizer::handleCircularReference()
method will have two new$format
and$context
arguments in version 5.0, not defining them is deprecated.
- The
TranslatorInterface
has been deprecated in favor ofSymfony\Contracts\Translation\TranslatorInterface
- The
Translator::transChoice()
method has been deprecated in favor of usingTranslator::trans()
with "%count%" as the parameter driving plurals - The
MessageSelector
,Interval
andPluralizationRules
classes have been deprecated, useIdentityTranslator
instead - The
Translator::getFallbackLocales()
andTranslationDataCollector::getFallbackLocales()
method have been marked as internal
- The
transchoice
tag and filter have been deprecated, use thetrans
ones instead with a%count%
parameter.
- The
checkMX
andcheckHost
properties of the Email constraint are deprecated - The component is now decoupled from
symfony/translation
and usesSymfony\Contracts\Translation\TranslatorInterface
instead - The
ValidatorBuilderInterface
has been deprecated andValidatorBuilder
made final - Deprecated validating instances of
\DateTimeInterface
inDateTimeValidator
,DateValidator
andTimeValidator
. UseType
instead or remove the constraint if the underlying model is type hinted to\DateTimeInterface
already. - Using the
Bic
,Country
,Currency
,Language
andLocale
constraints withoutsymfony/intl
is deprecated - Using the
Email
constraint withoutegulias/email-validator
is deprecated - Using the
Expression
constraint withoutsymfony/expression-language
is deprecated
- Omitting the
$environment
argument of theServerRunCommand
andServerStartCommand
constructors is deprecated.