- Renamed
ClienttoAbstractBrowser - Marked
Responsefinal. - Deprecated
Response::buildHeader() - Deprecated
Response::getStatus(), useResponse::getStatusCode()instead
- The
psr/simple-cachedependency has been removed - runcomposer require psr/simple-cacheif you need it. - Deprecated all PSR-16 adapters, use
Psr16CacheorSymfony\Contracts\Cache\CacheInterfaceimplementations instead. - Deprecated
SimpleCacheAdapter, usePsr16Adapterinstead.
- Deprecated using environment variables with
cannotBeEmpty()if the value is validated withvalidate() - Deprecated the
root()method inTreeBuilder, pass the root node information to the constructor instead
-
Deprecated support for non-string default env() parameters
Before:
parameters: env(NAME): 1.5
After:
parameters: env(NAME): '1.5'
- Passing an
IdReaderto theDoctrineChoiceLoaderwhen the query cannot be optimized with single id field has been deprecated, passnullinstead - Not passing an
IdReaderto theDoctrineChoiceLoaderwhen the query can be optimized with single id field has been deprecated
- First parameter of
Dotenv::__construct()will be changed fromtruetofalsein Symfony 5.0. A deprecation warning is triggered if no parameter is provided. Use$usePutenv = trueto upgrade without breaking changes.
-
The signature of the
EventDispatcherInterface::dispatch()method has been updated, consider using the new signaturedispatch($event, string $eventName = null)instead of the old signaturedispatch($eventName, $event)that is deprecatedYou have to swap arguments when calling
dispatch():Before:
$this->eventDispatcher->dispatch(Events::My_EVENT, $event);
After:
$this->eventDispatcher->dispatch($event, Events::My_EVENT);
If your bundle or package needs to provide compatibility with the previous way of using the dispatcher, you can use
Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy::decorate()to ease upgrades:Before:
public function __construct(EventDispatcherInterface $eventDispatcher) { $this->eventDispatcher = $eventDispatcher; }
After:
public function __construct(EventDispatcherInterface $eventDispatcher) { $this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher); }
-
The
Eventclass has been deprecated, useSymfony\Contracts\EventDispatcher\Eventinstead
- Support for passing arrays to
Filesystem::dumpFile()is deprecated. - Support for passing arrays to
Filesystem::appendToFile()is deprecated.
- Using the
formatoption ofDateTypeandDateTimeTypewhen thehtml5option is enabled is deprecated. - Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated and will lead to an exception in 5.0.
- Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons is deprecated and will lead to an exception in 5.0.
- Using the
date_format,date_widget, andtime_widgetoptions of theDateTimeTypewhen thewidgetoption is set tosingle_textis deprecated.
- Deprecated the
framework.templatingoption, configure the Twig bundle instead. - Not passing the project directory to the constructor of the
AssetsInstallCommandis deprecated. This argument will be mandatory in 5.0. - Deprecated the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead.
- The
generate()method of theUrlGeneratorclass can return an empty string instead of null.
- The
MimeTypeGuesserInterfaceandExtensionGuesserInterfaceinterfaces have been deprecated, useSymfony\Component\Mime\MimeTypesInterfaceinstead. - The
MimeTypeandMimeTypeExtensionGuesserclasses have been deprecated, useSymfony\Component\Mime\MimeTypesinstead. - The
FileBinaryMimeTypeGuesserclass has been deprecated, useSymfony\Component\Mime\FileBinaryMimeTypeGuesserinstead. - The
FileinfoMimeTypeGuesserclass has been deprecated, useSymfony\Component\Mime\FileinfoMimeTypeGuesserinstead.
- Renamed
ClienttoHttpKernelBrowser - Renamed
FilterControllerArgumentsEventtoControllerArgumentsEvent - Renamed
FilterControllerEventtoControllerEvent - Renamed
FilterResponseEventtoResponseEvent - Renamed
GetResponseEventtoRequestEvent - Renamed
GetResponseForControllerResultEventtoViewEvent - Renamed
GetResponseForExceptionEventtoExceptionEvent - Renamed
PostResponseEventtoTerminateEvent - Deprecated
TranslatorListenerin favor ofLocaleAwareListener
- Deprecated
ResourceBundlenamespace - Deprecated
Intl::getCurrencyBundle(), useCurrenciesinstead - Deprecated
Intl::getLanguageBundle(), useLanguagesorScriptsinstead - Deprecated
Intl::getLocaleBundle(), useLocalesinstead - Deprecated
Intl::getRegionBundle(), useCountriesinstead
Amqptransport does not throw\AMQPExceptionanymore, catchTransportExceptioninstead.- Deprecated the
LoggingMiddlewareclass, pass a logger toSendMessageMiddlewareinstead.
- The
generator_base_class,generator_cache_class,matcher_base_class, andmatcher_cache_classrouter options have been deprecated. Serializableimplementing methods forRouteandCompiledRouteare marked as@internaland@final. Instead of overwriting them, use__serializeand__unserializeas extension points which are forward compatible with the new serialization methods in PHP 7.4.
-
The
RoleandSwitchUserRoleclasses are deprecated and will be removed in 5.0. Use strings for roles instead. -
The
getReachableRoles()method of theRoleHierarchyInterfaceis deprecated and will be removed in 5.0. Role hierarchies must implement thegetReachableRoleNames()method instead and return roles as strings. -
The
getRoles()method of theTokenInterfaceis deprecated. Tokens must implement thegetRoleNames()method instead and return roles as strings. -
The
ListenerInterfaceis deprecated, turn your listeners into callables instead. -
The
Firewall::handleRequest()method is deprecated, useFirewall::callListeners()instead. -
The
AbstractToken::serialize(),AbstractToken::unserialize(),AuthenticationException::serialize()andAuthenticationException::unserialize()methods are now final, 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 deprecated, useSodiumPasswordEncoderinstead. -
The
BCryptPasswordEncoderclass has been deprecated, useNativePasswordEncoderinstead. -
Not implementing the methods
__serializeand__unserializein classes implementing theTokenInterfaceis deprecated
- deprecated the
$requestStackand$requestContextarguments of theHttpFoundationExtension, pass aSymfony\Component\HttpFoundation\UrlHelperinstance as the only argument instead
-
initial_placeis deprecated in favour ofinitial_marking.Before:
framework: workflows: article: initial_place: draft
After:
framework: workflows: article: initial_marking: [draft]
-
WorkflowInterface::apply()will have a third argument in Symfony 5.0.Before:
class MyWorkflow implements WorkflowInterface { public function apply($subject, $transitionName) { } }
After:
class MyWorkflow implements WorkflowInterface { public function apply($subject, $transitionName, array $context = []) { } }
-
MarkingStoreInterface::setMarking()will have a third argument in Symfony 5.0.Before:
class MyMarkingStore implements MarkingStoreInterface { public function setMarking($subject, Marking $marking) { } }
After:
class MyMarkingStore implements MarkingStoreInterface { public function setMarking($subject, Marking $marking , array $context = []) { } }
-
MultipleStateMarkingStoreis deprecated. UseMethodMarkingStoreinstead.Before:
framework: workflows: article: type: workflow marking_store: type: multiple_state arguments: states
After:
framework: workflows: article: type: workflow marking_store: type: method property: states
-
SingleStateMarkingStoreis deprecated. UseMethodMarkingStoreinstead.Before:
framework: workflows: article: marking_store: arguments: state
After:
framework: workflows: article: type: state_machine marking_store: type: method property: state
-
Using a workflow with a single state marking is deprecated. Use a state machine instead.
Before:
framework: workflows: article: type: workflow marking_store: type: single_state
After:
framework: workflows: article: type: state_machine marking_store: # type: single_state # Since the single_state marking store is deprecated, use method instead type: method
-
Using
DefinitionBuilder::setInitialPlace()is deprecated, useDefinitionBuilder::setInitialPlaces()instead.
- Using a mapping inside a multi-line string is deprecated and will throw a
ParseExceptionin 5.0.