- Added argument
$prefix
toAdapterInterface::clear()
- Marked the
CacheDataCollector
class as@final
.
- Deprecated finding hidden commands using an abbreviation, use the full name instead
- Deprecated returning
null
fromCommand::execute()
, return0
instead - Deprecated the
Application::renderException()
andApplication::doRenderException()
methods, userenderThrowable()
anddoRenderThrowable()
instead.
- Deprecated the component in favor of the
ErrorHandler
component - Replace uses of
Symfony\Component\Debug\Debug
bySymfony\Component\ErrorHandler\Debug
- Deprecated overriding the
FilerLoader::import()
method without declaring the optional$exclude
argument
-
Made singly-implemented interfaces detection be scoped by file
-
Deprecated 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]
-
Passing an instance of
Symfony\Component\DependencyInjection\Parameter
as class name toSymfony\Component\DependencyInjection\Definition
is deprecated.Before:
new Definition(new Parameter('my_class'));
After:
new Definition('%my_class%');
- Deprecated injecting
ClassMetadataFactory
inDoctrineExtractor
, an instance ofEntityManagerInterface
should be injected instead. - Deprecated passing an
IdReader
to theDoctrineChoiceLoader
when the query cannot be optimized with single id field. - Deprecated not passing an
IdReader
to theDoctrineChoiceLoader
when the query can be optimized with single id field. - Deprecated
RegistryInterface
, useDoctrine\Common\Persistence\ManagerRegistry
. - Added a new
getMetadataDriverClass
method to replace class parameters inAbstractDoctrineExtension
. This method will be abstract in Symfony 5 and must be declared in extending classes.
- Support for passing a
null
value toFilesystem::isAbsolutePath()
is deprecated.
- Using different values for the "model_timezone" and "view_timezone" options of the
TimeType
without configuring a reference date is deprecated. - Using
int
orfloat
as data for theNumberType
when theinput
option is set tostring
is deprecated. - Overriding the methods
FormIntegrationTestCase::setUp()
,TypeTestCase::setUp()
andTypeTestCase::tearDown()
without thevoid
return-type is deprecated.
- Deprecated calling
WebTestCase::createClient()
while a kernel has been booted, ensure the kernel is shut down before calling the method - Deprecated support for
templating
engine inTemplateController
, use Twig instead - The
$parser
argument ofControllerResolver::__construct()
andDelegatingLoader::__construct()
has been deprecated. - The
ControllerResolver
andDelegatingLoader
classes have been marked asfinal
. - The
controller_name_converter
andresolve_controller_name_subscriber
services have been deprecated. - Deprecated
routing.loader.service
, userouting.loader.container
instead. - Not tagging service route loaders with
routing.route_loader
has been deprecated. - Overriding the methods
KernelTestCase::tearDown()
andWebTestCase::tearDown()
without thevoid
return-type is deprecated. - Marked the
RouterDataCollector
class as@final
.
- Added method
cancel()
toResponseInterface
ApacheRequest
is deprecated, useRequest
class instead.- Passing a third argument to
HeaderBag::get()
is deprecated since Symfony 4.4, use methodall()
instead - [BC BREAK]
PdoSessionHandler
with MySQL changed the type of the lifetime column, make sure to runALTER TABLE sessions MODIFY sess_lifetime INTEGER UNSIGNED NOT NULL
to update your database. PdoSessionHandler
now precalculates the expiry timestamp in the lifetime column, make sure to runCREATE INDEX EXPIRY ON sessions (sess_lifetime)
to update your database to speed up garbage collection of expired sessions.
-
The
DebugHandlersListener
class has been marked asfinal
-
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.
-
Deprecated the second and third argument of
KernelInterface::locateResource
-
Deprecated the second and third argument of
FileLocator::__construct
-
Deprecated loading resources from
%kernel.root_dir%/Resources
and%kernel.root_dir%
as fallback directories. Resources like service definitions are usually loaded relative to the current directory or with a glob pattern. The fallback directories have never been advocated so you likely do not use those in any app based on the SF Standard or Flex edition. -
Getting the container from a non-booted kernel is deprecated
-
Marked the
AjaxDataCollector
,ConfigDataCollector
,EventDataCollector
,ExceptionDataCollector
,LoggerDataCollector
,MemoryDataCollector
,RequestDataCollector
andTimeDataCollector
classes as@final
. -
Marked the
RouterDataCollector::collect()
method as@final
. -
The
DataCollectorInterface::collect()
andProfiler::collect()
methods third parameter signature will be\Throwable $exception = null
instead of\Exception $exception = null
in Symfony 5.0. -
Deprecated methods
ExceptionEvent::get/setException()
, useget/setThrowable()
instead -
Deprecated class
ExceptionListener
, useErrorListener
instead
- Deprecated
Symfony\Component\Lock\StoreInterface
in favor ofSymfony\Component\Lock\BlockingStoreInterface
andSymfony\Component\Lock\PersistingStoreInterface
. Factory
is deprecated, useLockFactory
instead- Deprecated services
lock.store.flock
,lock.store.semaphore
,lock.store.memcached.abstract
andlock.store.redis.abstract
, useStoreFactory::createStore
instead.
- [BC BREAK] Changed the DSN to use for disabling delivery (using the
NullTransport
) fromsmtp://null
tonull://null
(host doesn't matter). - [BC BREAK] Renamed class
SmtpEnvelope
toEnvelope
andDelayedSmtpEnvelope
toDelayedEnvelope
. - [BC BREAK] Added a required
string $transport
argument toMessageEvent::__construct
.
- [BC BREAK] Removed
SendersLocatorInterface::getSenderByAlias
added in 4.3. - [BC BREAK] Removed
$retryStrategies
argument fromWorker::__construct
. - [BC BREAK] Changed arguments of
ConsumeMessagesCommand::__construct
. - [BC BREAK] Removed
$senderClassOrAlias
argument fromRedeliveryStamp::__construct
. - [BC BREAK] Removed
UnknownSenderException
. - [BC BREAK] Removed
WorkerInterface
. - [BC BREAK] Removed
$onHandledCallback
ofWorker::run(array $options = [], callable $onHandledCallback = null)
. - [BC BREAK] Removed
StopWhenMemoryUsageIsExceededWorker
in favor ofStopWorkerOnMemoryLimitListener
. - [BC BREAK] Removed
StopWhenMessageCountIsExceededWorker
in favor ofStopWorkerOnMessageLimitListener
. - [BC BREAK] Removed
StopWhenTimeLimitIsReachedWorker
in favor ofStopWorkerOnTimeLimitListener
. - [BC BREAK] Removed
StopWhenRestartSignalIsReceived
in favor ofStopWorkerOnRestartSignalListener
. - Marked the
MessengerDataCollector
class as@final
.
- Removed
NamedAddress
, useAddress
instead (which supports a name now)
- The
RouteProcessor
has been marked final.
- Deprecated the
Process::inheritEnvironmentVariables()
method: env variables are always inherited.
- Deprecated passing
null
as 2nd argument ofPropertyAccessor::createCache()
method ($defaultLifetime
), pass0
instead.
- Deprecated
ServiceRouterLoader
in favor ofContainerLoader
. - Deprecated
ObjectRouteLoader
in favor ofObjectLoader
.
-
The
LdapUserProvider
class has been deprecated, useSymfony\Component\Ldap\Security\LdapUserProvider
instead. -
Implementations of
PasswordEncoderInterface
andUserPasswordEncoderInterface
should add a newneedsRehash()
method -
Deprecated returning a non-boolean value when implementing
Guard\AuthenticatorInterface::checkCredentials()
. Please explicitly returnfalse
to indicate invalid credentials. -
The
ListenerInterface
is deprecated, extendAbstractListener
instead. -
Deprecated 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') ) {}
- Marked the
SecurityDataCollector
class as@final
.
- Deprecated the
XmlEncoder::TYPE_CASE_ATTRIBUTES
constant. UseXmlEncoder::TYPE_CAST_ATTRIBUTES
instead.
- Deprecated passing
null
as 1st ($id
) argument ofSection::get()
method, pass a valid child section identifier instead.
- Deprecated support for using
null
as the locale inTranslator
. - Deprecated accepting STDIN implicitly when using the
lint:xliff
command, uselint:xliff -
(append a dash) instead to make it explicit. - Marked the
TranslationDataCollector
class as@final
.
- Deprecated to pass
$rootDir
and$fileLinkFormatter
as 5th and 6th argument respectively to theDebugCommand::__construct()
method, swap the variables position. - Deprecated accepting STDIN implicitly when using the
lint:twig
command, uselint:twig -
(append a dash) instead to make it explicit. - Marked the
TwigDataCollector
class as@final
.
-
Deprecated
twig.exception_controller
configuration option.If you were not using this option previously, set it to
null
:After:
twig: exception_controller: null
If you were using this option previously, set it to
null
and useframework.error_controller
instead:Before:
twig: exception_controller: 'App\Controller\MyExceptionController'
After:
twig: exception_controller: null framework: error_controller: 'App\Controller\MyExceptionController'
The new default exception controller will also change the error response content according to https://tools.ietf.org/html/rfc7807 for
json
,xml
,atom
andtxt
formats:Before (HTTP status code
200
):{ "error": { "code": 404, "message": "Sorry, the page you are looking for could not be found" } }
After (HTTP status code
404
):{ "title": "Not Found", "status": 404, "detail": "Sorry, the page you are looking for could not be found" }
-
Deprecated the
ExceptionController
andPreviewErrorController
controllers, useErrorController
from the HttpKernel component instead -
Deprecated all built-in error templates, use the error renderer mechanism of the
ErrorHandler
component -
Deprecated loading custom error templates in non-html formats. Custom HTML error pages based on Twig keep working as before:
Before (
templates/bundles/TwigBundle/Exception/error.json.twig
):{ "type": "https://example.com/error", "title": "{{ status_text }}", "status": {{ status_code }} }
After (
App\Serializer\ProblemJsonNormalizer
):class ProblemJsonNormalizer implements NormalizerInterface { public function normalize($exception, $format = null, array $context = []) { return [ 'type' => 'https://example.com/error', 'title' => $exception->getStatusText(), 'status' => $exception->getStatusCode(), ]; } public function supportsNormalization($data, $format = null) { return 'json' === $format && $data instanceof FlattenException; } }
- [BC BREAK] Using null as
$classValidatorRegexp
value inDoctrineLoader::__construct
orPropertyInfoLoader::__construct
will not enable auto-mapping for all classes anymore, use'{.*}'
instead. - Deprecated passing an
ExpressionLanguage
instance as the second argument ofExpressionValidator::__construct()
. - Deprecated using anything else than a
string
as the code of aConstraintViolation
, astring
type-hint will be added to the constructor of theConstraintViolation
class and to theConstraintViolationBuilder::setCode()
method in 5.0. - Deprecated passing an
ExpressionLanguage
instance as the second argument ofExpressionValidator::__construct()
. Pass it as the first argument instead. - The
Length
constraint expects theallowEmptyString
option to be defined when themin
option is used. Set it totrue
to keep the current behavior andfalse
to reject empty strings. In 5.0, it'll become optional and will default tofalse
. - Overriding the methods
ConstraintValidatorTestCase::setUp()
andConstraintValidatorTestCase::tearDown()
without thevoid
return-type is deprecated. - deprecated
Symfony\Component\Validator\Mapping\Cache\CacheInterface
and all implementations in favor of PSR-6. - deprecated
ValidatorBuilder::setMetadataCache
, useValidatorBuilder::setMappingCache
instead. - The
Range
constraint has a new message optionnotInRangeMessage
that is used when bothmin
andmax
values are set. In case you are using custom translations make sure to add one for this new message. - Marked the
ValidatorDataCollector
class as@final
.
- Deprecated the
ExceptionController
class in favor ofExceptionErrorController
- Deprecated the
TemplateManager::templateExists()
method
- The bundle is deprecated and will be removed in 5.0.
- Deprecated accepting STDIN implicitly when using the
lint:yaml
command, uselint:yaml -
(append a dash) instead to make it explicit.