Remove UPGRADE files for 4.x
This commit is contained in:
parent
e1a522b470
commit
34a2ac6da6
1144
UPGRADE-4.0.md
1144
UPGRADE-4.0.md
File diff suppressed because it is too large
Load Diff
164
UPGRADE-4.1.md
164
UPGRADE-4.1.md
@ -1,164 +0,0 @@
|
|||||||
UPGRADE FROM 4.0 to 4.1
|
|
||||||
=======================
|
|
||||||
|
|
||||||
Config
|
|
||||||
------
|
|
||||||
|
|
||||||
* Implementing `ParentNodeDefinitionInterface` without the `getChildNodeDefinitions()` method
|
|
||||||
is deprecated.
|
|
||||||
|
|
||||||
Console
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated the `setCrossingChar()` method in favor of the `setDefaultCrossingChar()` method in `TableStyle`.
|
|
||||||
* The `Processor` class has been made final
|
|
||||||
* Deprecated the `setHorizontalBorderChar()` method in favor of the `setDefaultCrossingChars()` method in `TableStyle`.
|
|
||||||
* Deprecated the `getHorizontalBorderChar()` method in favor of the `getBorderChars()` method in `TableStyle`.
|
|
||||||
* Deprecated the `setVerticalBorderChar()` method in favor of the `setVerticalBorderChars()` method in `TableStyle`.
|
|
||||||
* Deprecated the `getVerticalBorderChar()` method in favor of the `getBorderChars()` method in `TableStyle`.
|
|
||||||
* Added support for `iterable` messages in `write` and `writeln` methods of `Symfony\Component\Console\Output\OutputInterface`.
|
|
||||||
If you have a custom implementation of the interface, you should make sure it works with iterable as well.
|
|
||||||
|
|
||||||
DependencyInjection
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
* Deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods.
|
|
||||||
* Deprecated support for auto-discovered extension configuration class which does not implement `ConfigurationInterface`.
|
|
||||||
|
|
||||||
EventDispatcher
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* The `TraceableEventDispatcherInterface` has been deprecated.
|
|
||||||
|
|
||||||
Form
|
|
||||||
----
|
|
||||||
|
|
||||||
* Deprecated the `ChoiceLoaderInterface` implementation in `CountryType`,
|
|
||||||
`LanguageType`, `LocaleType` and `CurrencyType`, use the `choice_loader`
|
|
||||||
option instead.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
class MyCountryType extends CountryType
|
|
||||||
{
|
|
||||||
public function loadChoiceList()
|
|
||||||
{
|
|
||||||
// override the method
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
class MyCountryType extends AbstractType
|
|
||||||
{
|
|
||||||
public function getParent()
|
|
||||||
{
|
|
||||||
return CountryType::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver->setDefault('choice_loader', ...); // override the option instead
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* Added `help` option to the form field. If you have custom Form extension for it, you should remove it.
|
|
||||||
Also remove it from the custom form theme.
|
|
||||||
|
|
||||||
FrameworkBundle
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* Deprecated `bundle:controller:action` and `service:action` syntaxes to reference controllers. Use `serviceOrFqcn::method`
|
|
||||||
instead where `serviceOrFqcn` is either the service ID when using controllers as services or the FQCN of the controller.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
bundle_controller:
|
|
||||||
path: /
|
|
||||||
defaults:
|
|
||||||
_controller: FrameworkBundle:Redirect:redirect
|
|
||||||
|
|
||||||
service_controller:
|
|
||||||
path: /
|
|
||||||
defaults:
|
|
||||||
_controller: app.my_controller:myAction
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
bundle_controller:
|
|
||||||
path: /
|
|
||||||
defaults:
|
|
||||||
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
|
|
||||||
|
|
||||||
service_controller:
|
|
||||||
path: /
|
|
||||||
defaults:
|
|
||||||
_controller: app.my_controller::myAction
|
|
||||||
```
|
|
||||||
|
|
||||||
* Deprecated `Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser`
|
|
||||||
* Warming up a router in `RouterCacheWarmer` that does not implement the `WarmableInterface` is deprecated and will not be
|
|
||||||
supported anymore in 5.0.
|
|
||||||
* The `RequestDataCollector` class has been deprecated. Use the `Symfony\Component\HttpKernel\DataCollector\RequestDataCollector` class instead.
|
|
||||||
|
|
||||||
HttpFoundation
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* Passing the file size to the constructor of the `UploadedFile` class is deprecated.
|
|
||||||
* The `getClientSize()` method of the `UploadedFile` class is deprecated. Use `getSize()` instead.
|
|
||||||
* Deprecated `Symfony\Component\HttpFoundation\Request::getSession()` when no session has been set. Use `Symfony\Component\HttpFoundation\Request::hasSession()` instead.
|
|
||||||
|
|
||||||
Security
|
|
||||||
--------
|
|
||||||
|
|
||||||
* The `ContextListener::setLogoutOnUserChange()` method is deprecated.
|
|
||||||
* Using the `AdvancedUserInterface` is now deprecated. To use the existing
|
|
||||||
functionality, create a custom user-checker based on the
|
|
||||||
`Symfony\Component\Security\Core\User\UserChecker`.
|
|
||||||
* `AuthenticationUtils::getLastUsername()` now always returns a string.
|
|
||||||
* The `ExpressionVoter::addExpressionLanguageProvider()` method is deprecated. Register the provider directly on the injected ExpressionLanguage instance instead.
|
|
||||||
|
|
||||||
SecurityBundle
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* The `logout_on_user_change` firewall option is deprecated.
|
|
||||||
* The `switch_user.stateless` firewall option is deprecated, use the `stateless` option instead.
|
|
||||||
* The `SecurityUserValueResolver` class is deprecated, use
|
|
||||||
`Symfony\Component\Security\Http\Controller\UserValueResolver` instead.
|
|
||||||
|
|
||||||
Serializer
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Decoding XML with `XmlEncoder` now ignores comment node types by default.
|
|
||||||
|
|
||||||
Translation
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* The `FileDumper::setBackup()` method is deprecated.
|
|
||||||
* The `TranslationWriter::disableBackup()` method is deprecated.
|
|
||||||
|
|
||||||
TwigBundle
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Deprecated relying on the default value (`false`) of the `twig.strict_variables` configuration option. You should use `%kernel.debug%` explicitly instead, which will be the new default in 5.0.
|
|
||||||
|
|
||||||
Validator
|
|
||||||
--------
|
|
||||||
|
|
||||||
* The `Email::__construct()` 'strict' property is deprecated. Use 'mode'=>"strict" instead.
|
|
||||||
* Calling `EmailValidator::__construct()` method with a boolean parameter is deprecated, use `EmailValidator("strict")` instead.
|
|
||||||
* Deprecated the `checkDNS` and `dnsMessage` options of the `Url` constraint.
|
|
||||||
|
|
||||||
Workflow
|
|
||||||
--------
|
|
||||||
|
|
||||||
* Deprecated the `DefinitionBuilder::reset()` method, use the `clear()` one instead.
|
|
||||||
* Deprecated the `add` method in favor of the `addWorkflow` method in `Workflow\Registry`.
|
|
||||||
* Deprecated `SupportStrategyInterface` in favor of `WorkflowSupportStrategyInterface`.
|
|
||||||
* Deprecated the class `ClassInstanceSupportStrategy` in favor of the class `InstanceOfSupportStrategy`.
|
|
||||||
* Deprecated passing the workflow name as 4th parameter of `Event` constructor in favor of the workflow itself.
|
|
393
UPGRADE-4.2.md
393
UPGRADE-4.2.md
@ -1,393 +0,0 @@
|
|||||||
UPGRADE FROM 4.1 to 4.2
|
|
||||||
=======================
|
|
||||||
|
|
||||||
BrowserKit
|
|
||||||
----------
|
|
||||||
|
|
||||||
* The `Client::submit()` method will have a new `$serverParameters` argument in version 5.0, not defining it is deprecated.
|
|
||||||
|
|
||||||
Cache
|
|
||||||
-----
|
|
||||||
|
|
||||||
* Deprecated `CacheItem::getPreviousTags()`, use `CacheItem::getMetadata()` instead.
|
|
||||||
|
|
||||||
Config
|
|
||||||
------
|
|
||||||
|
|
||||||
* Deprecated constructing a `TreeBuilder` without passing root node information:
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
$treeBuilder = new TreeBuilder();
|
|
||||||
$rootNode = $treeBuilder->root('my_config');
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
$treeBuilder = new TreeBuilder('my_config');
|
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
|
||||||
```
|
|
||||||
|
|
||||||
* Deprecated `FileLoaderLoadException`, use `LoaderLoadException` instead.
|
|
||||||
|
|
||||||
Console
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated passing a command as a string to `ProcessHelper::run()`,
|
|
||||||
pass the command as an array of arguments instead.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
$processHelper->run($output, 'ls -l');
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
$processHelper->run($output, array('ls', '-l'));
|
|
||||||
|
|
||||||
// alternatively, when a shell wrapper is required
|
|
||||||
$processHelper->run($output, Process::fromShellCommandline('ls -l'));
|
|
||||||
```
|
|
||||||
|
|
||||||
DoctrineBridge
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* The `lazy` attribute on `doctrine.event_listener` tags was removed.
|
|
||||||
Listeners are now lazy by default. So any `lazy` attributes can safely be removed from those tags.
|
|
||||||
|
|
||||||
DomCrawler
|
|
||||||
----------
|
|
||||||
|
|
||||||
* The `Crawler::children()` method will have a new `$selector` argument in version 5.0, not defining it is deprecated.
|
|
||||||
|
|
||||||
Finder
|
|
||||||
------
|
|
||||||
|
|
||||||
* The `Finder::sortByName()` method will have a new `$useNaturalSort` argument in version 5.0, not defining it is deprecated.
|
|
||||||
|
|
||||||
Form
|
|
||||||
----
|
|
||||||
|
|
||||||
* The `symfony/translation` dependency has been removed - run `composer require symfony/translation` if you need the component
|
|
||||||
* The `getExtendedType()` method of the `FormTypeExtensionInterface` is deprecated and will be removed in 5.0. Type
|
|
||||||
extensions must implement the static `getExtendedTypes()` method instead and return an iterable of extended types.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
|
|
||||||
```php
|
|
||||||
class FooTypeExtension extends AbstractTypeExtension
|
|
||||||
{
|
|
||||||
public function getExtendedType()
|
|
||||||
{
|
|
||||||
return FormType::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
|
|
||||||
```php
|
|
||||||
class FooTypeExtension extends AbstractTypeExtension
|
|
||||||
{
|
|
||||||
public static function getExtendedTypes(): iterable
|
|
||||||
{
|
|
||||||
return array(FormType::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
* The `scale` option of the `IntegerType` is deprecated.
|
|
||||||
* The `$scale` argument of the `IntegerToLocalizedStringTransformer` 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:
|
|
||||||
```twig
|
|
||||||
{% for field in fieldsWithPotentialDuplicates %}
|
|
||||||
{{ form_widget(field) }}
|
|
||||||
{% endfor %}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```twig
|
|
||||||
{% for field in fieldsWithPotentialDuplicates if not field.rendered %}
|
|
||||||
{{ form_widget(field) }}
|
|
||||||
{% endfor %}
|
|
||||||
```
|
|
||||||
|
|
||||||
* The `regions` option of the `TimezoneType` is deprecated.
|
|
||||||
|
|
||||||
FrameworkBundle
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* The following middleware service ids were renamed:
|
|
||||||
- `messenger.middleware.call_message_handler` becomes `messenger.middleware.handle_message`
|
|
||||||
- `messenger.middleware.route_messages` becomes `messenger.middleware.send_message`
|
|
||||||
|
|
||||||
If you set `framework.messenger.buses.[bus_id].default_middleware` to `false`,
|
|
||||||
replace any of these names in the `framework.messenger.buses.[bus_id].middleware` list.
|
|
||||||
* The `allow_no_handler` middleware has been removed. Use `framework.messenger.buses.[bus_id].default_middleware` instead:
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
messenger:
|
|
||||||
buses:
|
|
||||||
messenger.bus.events:
|
|
||||||
middleware:
|
|
||||||
- allow_no_handler
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
messenger:
|
|
||||||
buses:
|
|
||||||
messenger.bus.events:
|
|
||||||
default_middleware: allow_no_handlers
|
|
||||||
```
|
|
||||||
|
|
||||||
* The `messenger:consume-messages` command expects a mandatory `--bus` option value if you have more than one bus configured.
|
|
||||||
* The `framework.router.utf8` configuration option has been added. If your app's charset
|
|
||||||
is UTF-8 (see kernel's `getCharset()` method), it is recommended to set it to `true`:
|
|
||||||
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`) to `lax` for increased security against CSRF attacks.
|
|
||||||
* The `Controller` class has been deprecated, use `AbstractController` instead.
|
|
||||||
* The Messenger encoder/decoder configuration has been changed for a unified Messenger serializer configuration.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
messenger:
|
|
||||||
encoder: your_encoder_service_id
|
|
||||||
decoder: your_decoder_service_id
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
messenger:
|
|
||||||
serializer:
|
|
||||||
id: your_messenger_service_id
|
|
||||||
```
|
|
||||||
* The `ContainerAwareCommand` class has been deprecated, use `Symfony\Component\Console\Command\Command`
|
|
||||||
with dependency injection instead.
|
|
||||||
* The `Templating\Helper\TranslatorHelper::transChoice()` method has been deprecated, use the `trans()` one instead with a `%count%` parameter.
|
|
||||||
* Deprecated support for legacy translations directories `src/Resources/translations/` and `src/Resources/<BundleName>/translations/`, use `translations/` instead.
|
|
||||||
* Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been deprecated.
|
|
||||||
|
|
||||||
HttpFoundation
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* 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.
|
|
||||||
|
|
||||||
HttpKernel
|
|
||||||
----------
|
|
||||||
|
|
||||||
* The `Kernel::getRootDir()` and the `kernel.root_dir` parameter have been deprecated
|
|
||||||
* The `KernelInterface::getName()` and the `kernel.name` parameter have been deprecated
|
|
||||||
* Deprecated the first and second constructor argument of `ConfigDataCollector`
|
|
||||||
* Deprecated `ConfigDataCollector::getApplicationName()`
|
|
||||||
* Deprecated `ConfigDataCollector::getApplicationVersion()`
|
|
||||||
|
|
||||||
Messenger
|
|
||||||
---------
|
|
||||||
|
|
||||||
* The `MiddlewareInterface::handle()` and `SenderInterface::send()` methods must now return an `Envelope` instance.
|
|
||||||
* The return value of handlers isn't forwarded anymore by middleware and buses.
|
|
||||||
If you used to return a value, e.g in query bus handlers, you can either:
|
|
||||||
- get the result from the `HandledStamp` in the envelope returned by the bus.
|
|
||||||
- use the `HandleTrait` to leverage a message bus, expecting a single, synchronous message handling and returning its result.
|
|
||||||
- make your `Query` mutable to allow setting & getting a result:
|
|
||||||
```php
|
|
||||||
// When dispatching:
|
|
||||||
$bus->dispatch($query = new Query());
|
|
||||||
$result = $query->getResult();
|
|
||||||
|
|
||||||
// In your handler:
|
|
||||||
$query->setResult($yourResult);
|
|
||||||
```
|
|
||||||
* The `EnvelopeAwareInterface` was removed and the `MiddlewareInterface::handle()` method now requires an `Envelope` object
|
|
||||||
as first argument. When using built-in middleware with the provided `MessageBus`, you will not have to do anything.
|
|
||||||
If you use your own `MessageBusInterface` implementation, you must wrap the message in an `Envelope` before passing it to middleware.
|
|
||||||
If you created your own middleware, you must change the signature to always expect an `Envelope`.
|
|
||||||
* The `MiddlewareInterface::handle()` second argument (`callable $next`) has changed in favor of a `StackInterface` instance.
|
|
||||||
When using built-in middleware with the provided `MessageBus`, you will not have to do anything.
|
|
||||||
If you use your own `MessageBusInterface` implementation, you can use the `StackMiddleware` implementation.
|
|
||||||
If you created your own middleware, you must change the signature to always expect an `StackInterface` instance
|
|
||||||
and call `$stack->next()->handle($envelope, $stack)` instead of `$next` to call the next middleware:
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
public function handle($message, callable $next): Envelope
|
|
||||||
{
|
|
||||||
// do something before
|
|
||||||
$message = $next($message);
|
|
||||||
// do something after
|
|
||||||
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
public function handle(Envelope $envelope, StackInterface $stack): Envelope
|
|
||||||
{
|
|
||||||
// do something before
|
|
||||||
$envelope = $stack->next()->handle($envelope, $stack);
|
|
||||||
// do something after
|
|
||||||
|
|
||||||
return $envelope;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
* `StampInterface` replaces `EnvelopeItemInterface` and doesn't extend `Serializable` anymore.
|
|
||||||
Built-in `ReceivedMessage`, `ValidationConfiguration` and `SerializerConfiguration` were renamed
|
|
||||||
respectively `ReceivedStamp`, `ValidationStamp`, `SerializerStamp` and moved to the `Stamp` namespace.
|
|
||||||
* `AllowNoHandlerMiddleware` has been removed in favor of a new constructor argument on `HandleMessageMiddleware`
|
|
||||||
* The `ConsumeMessagesCommand` class now takes an instance of `Psr\Container\ContainerInterface`
|
|
||||||
as first constructor argument, i.e a message bus locator. The CLI command now expects a mandatory
|
|
||||||
`--bus` option value if there is more than one bus in the locator.
|
|
||||||
* `MessageSubscriberInterface::getHandledMessages()` return value has changed. The value of an array item
|
|
||||||
needs to be an associative array or the method name.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
return [
|
|
||||||
[FirstMessage::class, 0],
|
|
||||||
[SecondMessage::class, -10],
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
yield FirstMessage::class => ['priority' => 0];
|
|
||||||
yield SecondMessage::class => ['priority' => -10];
|
|
||||||
```
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
return [
|
|
||||||
SecondMessage::class => ['secondMessageMethod', 20],
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
yield SecondMessage::class => [
|
|
||||||
'method' => 'secondMessageMethod',
|
|
||||||
'priority' => 20,
|
|
||||||
];
|
|
||||||
```
|
|
||||||
* The `EncoderInterface` and `DecoderInterface` interfaces have been replaced by a unified `Symfony\Component\Messenger\Transport\Serialization\SerializerInterface`.
|
|
||||||
Each interface method have been merged untouched into the `Serializer` interface, so you can simply merge your two implementations together and implement the new interface.
|
|
||||||
* The `HandlerLocator` class was replaced with `Symfony\Component\Messenger\Handler\HandlersLocator`.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
new HandlerLocator([
|
|
||||||
YourMessage::class => $handlerCallable,
|
|
||||||
]);
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
new HandlersLocator([
|
|
||||||
YourMessage::class => [
|
|
||||||
$handlerCallable,
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Monolog
|
|
||||||
-------
|
|
||||||
|
|
||||||
* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining it is deprecated.
|
|
||||||
|
|
||||||
Process
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods.
|
|
||||||
* Deprecated passing commands as strings when creating a `Process` instance.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
$process = new Process('ls -l');
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
$process = new Process(array('ls', '-l'));
|
|
||||||
|
|
||||||
// alternatively, when a shell wrapper is required
|
|
||||||
$process = Process::fromShellCommandline('ls -l');
|
|
||||||
```
|
|
||||||
|
|
||||||
Security
|
|
||||||
--------
|
|
||||||
|
|
||||||
* Using the `has_role()` function in security expressions is deprecated, use the `is_granted()` function instead.
|
|
||||||
* Not returning an array of 3 elements from `FirewallMapInterface::getListeners()` is deprecated, the 3rd element
|
|
||||||
must be an instance of `LogoutListener` or `null`.
|
|
||||||
* 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 existing `Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`
|
|
||||||
or `Symfony\Component\Security\Core\Authentication\Token\RememberMeToken`.
|
|
||||||
* Accessing the user object that is not an instance of `UserInterface` from `Security::getUser()` is deprecated.
|
|
||||||
* `SimpleAuthenticatorInterface`, `SimpleFormAuthenticatorInterface`, `SimplePreAuthenticatorInterface`,
|
|
||||||
`SimpleAuthenticationProvider`, `SimpleAuthenticationHandler`, `SimpleFormAuthenticationListener` and
|
|
||||||
`SimplePreAuthenticationListener` have been deprecated. Use Guard instead.
|
|
||||||
* **BC break note**: Upgrade to this version will log out all logged in users. See bug #33473.
|
|
||||||
|
|
||||||
SecurityBundle
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* Passing a `FirewallConfig` instance as 3rd argument to the `FirewallContext` constructor is deprecated,
|
|
||||||
pass a `LogoutListener` instance instead.
|
|
||||||
* Using the `security.authentication.trust_resolver.anonymous_class` and
|
|
||||||
`security.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` and `simple_preauth` authentication listeners have been deprecated,
|
|
||||||
use Guard instead.
|
|
||||||
* The `SimpleFormFactory` and `SimplePreAuthenticationFactory` classes have been deprecated,
|
|
||||||
use Guard instead.
|
|
||||||
|
|
||||||
Serializer
|
|
||||||
----------
|
|
||||||
|
|
||||||
* 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.
|
|
||||||
|
|
||||||
Translation
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* The `TranslatorInterface` has been deprecated in favor of `Symfony\Contracts\Translation\TranslatorInterface`
|
|
||||||
* The `Translator::transChoice()` method has been deprecated in favor of using `Translator::trans()` with "%count%" as the parameter driving plurals
|
|
||||||
* The `MessageSelector`, `Interval` and `PluralizationRules` classes have been deprecated, use `IdentityTranslator` instead
|
|
||||||
* The `Translator::getFallbackLocales()` and `TranslationDataCollector::getFallbackLocales()` method have been marked as internal
|
|
||||||
|
|
||||||
TwigBundle
|
|
||||||
----------
|
|
||||||
|
|
||||||
* The `transchoice` tag and filter have been deprecated, use the `trans` ones instead with a `%count%` parameter.
|
|
||||||
* Deprecated support for legacy templates directories `src/Resources/views/` and `src/Resources/<BundleName>/views/`, use `templates/` and `templates/bundles/<BundleName>/` instead.
|
|
||||||
|
|
||||||
Validator
|
|
||||||
---------
|
|
||||||
|
|
||||||
* The `symfony/translation` dependency has been removed - run `composer require symfony/translation` if you need the component
|
|
||||||
* The `checkMX` and `checkHost` options of the `Email` constraint are deprecated
|
|
||||||
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
|
|
||||||
* The `ValidatorBuilderInterface` has been deprecated and `ValidatorBuilder::setTranslator()` has been made final
|
|
||||||
* Deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
|
|
||||||
* Using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl` is deprecated
|
|
||||||
* Using the `Email` constraint in strict mode without `egulias/email-validator` is deprecated
|
|
||||||
* Using the `Expression` constraint without `symfony/expression-language` is deprecated
|
|
358
UPGRADE-4.3.md
358
UPGRADE-4.3.md
@ -1,358 +0,0 @@
|
|||||||
UPGRADE FROM 4.2 to 4.3
|
|
||||||
=======================
|
|
||||||
|
|
||||||
BrowserKit
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Renamed `Client` to `AbstractBrowser`
|
|
||||||
* Marked `Response` final.
|
|
||||||
* Deprecated `Response::buildHeader()`
|
|
||||||
* Deprecated `Response::getStatus()`, use `Response::getStatusCode()` instead
|
|
||||||
|
|
||||||
Cache
|
|
||||||
-----
|
|
||||||
|
|
||||||
* The `psr/simple-cache` dependency has been removed - run `composer require psr/simple-cache` if you need it.
|
|
||||||
* Deprecated all PSR-16 adapters, use `Psr16Cache` or `Symfony\Contracts\Cache\CacheInterface` implementations instead.
|
|
||||||
* Deprecated `SimpleCacheAdapter`, use `Psr16Adapter` instead.
|
|
||||||
|
|
||||||
Config
|
|
||||||
------
|
|
||||||
|
|
||||||
* Deprecated using environment variables with `cannotBeEmpty()` if the value is validated with `validate()`
|
|
||||||
* Deprecated the `root()` method in `TreeBuilder`, pass the root node information to the constructor instead
|
|
||||||
|
|
||||||
DependencyInjection
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
* Deprecated support for non-string default env() parameters
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
parameters:
|
|
||||||
env(NAME): 1.5
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
parameters:
|
|
||||||
env(NAME): '1.5'
|
|
||||||
```
|
|
||||||
|
|
||||||
Doctrine Bridge
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* Passing an `IdReader` to the `DoctrineChoiceLoader` when the query cannot be optimized with single id field has been deprecated, pass `null` instead
|
|
||||||
* Not passing an `IdReader` to the `DoctrineChoiceLoader` when the query can be optimized with single id field has been deprecated
|
|
||||||
|
|
||||||
Dotenv
|
|
||||||
------
|
|
||||||
|
|
||||||
* First parameter of `Dotenv::__construct()` will be changed from `true` to `false` in Symfony 5.0. A deprecation warning
|
|
||||||
is triggered if no parameter is provided. Use `$usePutenv = true` to upgrade without breaking changes.
|
|
||||||
|
|
||||||
EventDispatcher
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* The signature of the `EventDispatcherInterface::dispatch()` method has been updated, consider using the new signature `dispatch($event, string $eventName = null)` instead of the old signature `dispatch($eventName, $event)` that is deprecated
|
|
||||||
|
|
||||||
You have to swap arguments when calling `dispatch()`:
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
$this->eventDispatcher->dispatch(Events::My_EVENT, $event);
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
$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:
|
|
||||||
```php
|
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher) {
|
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
public function __construct(EventDispatcherInterface $eventDispatcher) {
|
|
||||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* The `Event` class has been deprecated, use `Symfony\Contracts\EventDispatcher\Event` instead
|
|
||||||
|
|
||||||
Filesystem
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Support for passing arrays to `Filesystem::dumpFile()` is deprecated.
|
|
||||||
* Support for passing arrays to `Filesystem::appendToFile()` is deprecated.
|
|
||||||
|
|
||||||
Form
|
|
||||||
----
|
|
||||||
|
|
||||||
* Using the `format` option of `DateType` and `DateTimeType` when the `html5` option 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`, and `time_widget` options of the `DateTimeType` when the `widget` option is
|
|
||||||
set to `single_text` is deprecated.
|
|
||||||
|
|
||||||
FrameworkBundle
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* Deprecated the `framework.templating` option, configure the Twig bundle instead.
|
|
||||||
* Not passing the project directory to the constructor of the `AssetsInstallCommand` is 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 the `UrlGenerator` class can return an empty string instead of null.
|
|
||||||
|
|
||||||
HttpFoundation
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* The `MimeTypeGuesserInterface` and `ExtensionGuesserInterface` interfaces have been deprecated,
|
|
||||||
use `Symfony\Component\Mime\MimeTypesInterface` instead.
|
|
||||||
* The `MimeType` and `MimeTypeExtensionGuesser` classes have been deprecated,
|
|
||||||
use `Symfony\Component\Mime\MimeTypes` instead.
|
|
||||||
* The `FileBinaryMimeTypeGuesser` class has been deprecated,
|
|
||||||
use `Symfony\Component\Mime\FileBinaryMimeTypeGuesser` instead.
|
|
||||||
* The `FileinfoMimeTypeGuesser` class has been deprecated,
|
|
||||||
use `Symfony\Component\Mime\FileinfoMimeTypeGuesser` instead.
|
|
||||||
|
|
||||||
HttpKernel
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Renamed `Client` to `HttpKernelBrowser`
|
|
||||||
* Renamed `FilterControllerArgumentsEvent` to `ControllerArgumentsEvent`
|
|
||||||
* Renamed `FilterControllerEvent` to `ControllerEvent`
|
|
||||||
* Renamed `FilterResponseEvent` to `ResponseEvent`
|
|
||||||
* Renamed `GetResponseEvent` to `RequestEvent`
|
|
||||||
* Renamed `GetResponseForControllerResultEvent` to `ViewEvent`
|
|
||||||
* Renamed `GetResponseForExceptionEvent` to `ExceptionEvent`
|
|
||||||
* Renamed `PostResponseEvent` to `TerminateEvent`
|
|
||||||
* Deprecated `TranslatorListener` in favor of `LocaleAwareListener`
|
|
||||||
|
|
||||||
Intl
|
|
||||||
----
|
|
||||||
|
|
||||||
* Deprecated `ResourceBundle` namespace
|
|
||||||
* Deprecated `Intl::getCurrencyBundle()`, use `Currencies` instead
|
|
||||||
* Deprecated `Intl::getLanguageBundle()`, use `Languages` or `Scripts` instead
|
|
||||||
* Deprecated `Intl::getLocaleBundle()`, use `Locales` instead
|
|
||||||
* Deprecated `Intl::getRegionBundle()`, use `Countries` instead
|
|
||||||
|
|
||||||
Messenger
|
|
||||||
---------
|
|
||||||
|
|
||||||
* `Amqp` transport does not throw `\AMQPException` anymore, catch `TransportException` instead.
|
|
||||||
* Deprecated the `LoggingMiddleware` class, pass a logger to `SendMessageMiddleware` instead.
|
|
||||||
|
|
||||||
Routing
|
|
||||||
-------
|
|
||||||
|
|
||||||
* The `generator_base_class`, `generator_cache_class`, `matcher_base_class`, and `matcher_cache_class` router
|
|
||||||
options have been deprecated.
|
|
||||||
* `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`.
|
|
||||||
Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible
|
|
||||||
with the new serialization methods in PHP 7.4.
|
|
||||||
|
|
||||||
Security
|
|
||||||
--------
|
|
||||||
|
|
||||||
* The `Role` and `SwitchUserRole` classes are deprecated and will be removed in 5.0. Use strings for roles
|
|
||||||
instead.
|
|
||||||
* The `getReachableRoles()` method of the `RoleHierarchyInterface` is deprecated and will be removed in 5.0.
|
|
||||||
Role hierarchies must implement the `getReachableRoleNames()` method instead and return roles as strings.
|
|
||||||
* The `getRoles()` method of the `TokenInterface` is deprecated. Tokens must implement the `getRoleNames()`
|
|
||||||
method instead and return roles as strings.
|
|
||||||
* The `ListenerInterface` is deprecated, turn your listeners into callables instead.
|
|
||||||
* The `Firewall::handleRequest()` method is deprecated, use `Firewall::callListeners()` instead.
|
|
||||||
* The `AbstractToken::serialize()`, `AbstractToken::unserialize()`,
|
|
||||||
`AuthenticationException::serialize()` and `AuthenticationException::unserialize()`
|
|
||||||
methods are now final, use `__serialize()` and `__unserialize()` instead.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
public function serialize()
|
|
||||||
{
|
|
||||||
return [$this->myLocalVar, parent::serialize()];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function unserialize($serialized)
|
|
||||||
{
|
|
||||||
[$this->myLocalVar, $parentSerialized] = unserialize($serialized);
|
|
||||||
parent::unserialize($parentSerialized);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
public function __serialize(): array
|
|
||||||
{
|
|
||||||
return [$this->myLocalVar, parent::__serialize()];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __unserialize(array $data): void
|
|
||||||
{
|
|
||||||
[$this->myLocalVar, $parentData] = $data;
|
|
||||||
parent::__unserialize($parentData);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* The `Argon2iPasswordEncoder` class has been deprecated, use `SodiumPasswordEncoder` instead.
|
|
||||||
* The `BCryptPasswordEncoder` class has been deprecated, use `NativePasswordEncoder` instead.
|
|
||||||
* Not implementing the methods `__serialize` and `__unserialize` in classes implementing
|
|
||||||
the `TokenInterface` is deprecated
|
|
||||||
|
|
||||||
TwigBridge
|
|
||||||
----------
|
|
||||||
|
|
||||||
* deprecated the `$requestStack` and `$requestContext` arguments of the
|
|
||||||
`HttpFoundationExtension`, pass a `Symfony\Component\HttpFoundation\UrlHelper`
|
|
||||||
instance as the only argument instead
|
|
||||||
|
|
||||||
Workflow
|
|
||||||
--------
|
|
||||||
|
|
||||||
* `initial_place` is deprecated in favour of `initial_marking`.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
initial_place: draft
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
initial_marking: [draft]
|
|
||||||
```
|
|
||||||
|
|
||||||
* `WorkflowInterface::apply()` will have a third argument in Symfony 5.0.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
class MyWorkflow implements WorkflowInterface
|
|
||||||
{
|
|
||||||
public function apply($subject, $transitionName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
class MyWorkflow implements WorkflowInterface
|
|
||||||
{
|
|
||||||
public function apply($subject, $transitionName, array $context = [])
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* `MarkingStoreInterface::setMarking()` will have a third argument in Symfony 5.0.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
class MyMarkingStore implements MarkingStoreInterface
|
|
||||||
{
|
|
||||||
public function setMarking($subject, Marking $marking)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
class MyMarkingStore implements MarkingStoreInterface
|
|
||||||
{
|
|
||||||
public function setMarking($subject, Marking $marking , array $context = [])
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* `MultipleStateMarkingStore` is deprecated. Use `MethodMarkingStore` instead.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
type: workflow
|
|
||||||
marking_store:
|
|
||||||
type: multiple_state
|
|
||||||
arguments: states
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
type: workflow
|
|
||||||
marking_store:
|
|
||||||
type: method
|
|
||||||
property: states
|
|
||||||
```
|
|
||||||
|
|
||||||
* `SingleStateMarkingStore` is deprecated. Use `MethodMarkingStore` instead.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
marking_store:
|
|
||||||
arguments: state
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
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:
|
|
||||||
```yaml
|
|
||||||
framework:
|
|
||||||
workflows:
|
|
||||||
article:
|
|
||||||
type: workflow
|
|
||||||
marking_store:
|
|
||||||
type: single_state
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
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, use `DefinitionBuilder::setInitialPlaces()` instead.
|
|
||||||
|
|
||||||
Yaml
|
|
||||||
----
|
|
||||||
|
|
||||||
* Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0.
|
|
396
UPGRADE-4.4.md
396
UPGRADE-4.4.md
@ -1,396 +0,0 @@
|
|||||||
UPGRADE FROM 4.3 to 4.4
|
|
||||||
=======================
|
|
||||||
|
|
||||||
Cache
|
|
||||||
-----
|
|
||||||
|
|
||||||
* Added argument `$prefix` to `AdapterInterface::clear()`
|
|
||||||
* Marked the `CacheDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
Console
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated finding hidden commands using an abbreviation, use the full name instead
|
|
||||||
* Deprecated returning `null` from `Command::execute()`, return `0` instead
|
|
||||||
* Deprecated the `Application::renderException()` and `Application::doRenderException()` methods,
|
|
||||||
use `renderThrowable()` and `doRenderThrowable()` instead.
|
|
||||||
|
|
||||||
Debug
|
|
||||||
-----
|
|
||||||
|
|
||||||
* Deprecated the component in favor of the `ErrorHandler` component
|
|
||||||
* Replace uses of `Symfony\Component\Debug\Debug` by `Symfony\Component\ErrorHandler\Debug`
|
|
||||||
|
|
||||||
Config
|
|
||||||
------
|
|
||||||
|
|
||||||
* Deprecated overriding the `FilerLoader::import()` method without declaring the optional `$exclude` argument
|
|
||||||
|
|
||||||
DependencyInjection
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
* Made singly-implemented interfaces detection be scoped by file
|
|
||||||
* Deprecated support for short factories and short configurators in Yaml
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
my_service:
|
|
||||||
factory: factory_service:method
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
my_service:
|
|
||||||
factory: ['@factory_service', method]
|
|
||||||
```
|
|
||||||
|
|
||||||
* Passing an instance of `Symfony\Component\DependencyInjection\Parameter` as class name to `Symfony\Component\DependencyInjection\Definition` is deprecated.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```php
|
|
||||||
new Definition(new Parameter('my_class'));
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```php
|
|
||||||
new Definition('%my_class%');
|
|
||||||
```
|
|
||||||
|
|
||||||
DoctrineBridge
|
|
||||||
--------------
|
|
||||||
* Deprecated injecting `ClassMetadataFactory` in `DoctrineExtractor`, an instance of `EntityManagerInterface` should be
|
|
||||||
injected instead.
|
|
||||||
* Deprecated passing an `IdReader` to the `DoctrineChoiceLoader` when the query cannot be optimized with single id field.
|
|
||||||
* Deprecated not passing an `IdReader` to the `DoctrineChoiceLoader` when the query can be optimized with single id field.
|
|
||||||
* Deprecated `RegistryInterface`, use `Doctrine\Common\Persistence\ManagerRegistry`.
|
|
||||||
* Added a new `getMetadataDriverClass` method to replace class parameters in `AbstractDoctrineExtension`. This method
|
|
||||||
will be abstract in Symfony 5 and must be declared in extending classes.
|
|
||||||
|
|
||||||
Filesystem
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated.
|
|
||||||
|
|
||||||
Form
|
|
||||||
----
|
|
||||||
|
|
||||||
* Using different values for the "model_timezone" and "view_timezone" options of the `TimeType` without configuring a
|
|
||||||
reference date is deprecated.
|
|
||||||
* Using `int` or `float` as data for the `NumberType` when the `input` option is set to `string` is deprecated.
|
|
||||||
* Overriding the methods `FormIntegrationTestCase::setUp()`, `TypeTestCase::setUp()` and `TypeTestCase::tearDown()` without the `void` return-type is deprecated.
|
|
||||||
|
|
||||||
FrameworkBundle
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* 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 in `TemplateController`, use Twig instead
|
|
||||||
* The `$parser` argument of `ControllerResolver::__construct()` and `DelegatingLoader::__construct()`
|
|
||||||
has been deprecated.
|
|
||||||
* The `ControllerResolver` and `DelegatingLoader` classes have been marked as `final`.
|
|
||||||
* The `controller_name_converter` and `resolve_controller_name_subscriber` services have been deprecated.
|
|
||||||
* Deprecated `routing.loader.service`, use `routing.loader.container` instead.
|
|
||||||
* Not tagging service route loaders with `routing.route_loader` has been deprecated.
|
|
||||||
* Overriding the methods `KernelTestCase::tearDown()` and `WebTestCase::tearDown()` without the `void` return-type is deprecated.
|
|
||||||
* Marked the `RouterDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
HttpClient
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Added method `cancel()` to `ResponseInterface`
|
|
||||||
|
|
||||||
HttpFoundation
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* `ApacheRequest` is deprecated, use `Request` class instead.
|
|
||||||
* Passing a third argument to `HeaderBag::get()` is deprecated since Symfony 4.4, use method `all()` instead
|
|
||||||
* [BC BREAK] `PdoSessionHandler` with MySQL changed the type of the lifetime column,
|
|
||||||
make sure to run `ALTER 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 run `CREATE INDEX EXPIRY ON sessions (sess_lifetime)` to update your database
|
|
||||||
to speed up garbage collection of expired sessions.
|
|
||||||
|
|
||||||
HttpKernel
|
|
||||||
----------
|
|
||||||
|
|
||||||
* The `DebugHandlersListener` class has been marked as `final`
|
|
||||||
* 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:
|
|
||||||
|
|
||||||
```php
|
|
||||||
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` and `TimeDataCollector` classes as `@final`.
|
|
||||||
* Marked the `RouterDataCollector::collect()` method as `@final`.
|
|
||||||
* The `DataCollectorInterface::collect()` and `Profiler::collect()` methods third parameter signature
|
|
||||||
will be `\Throwable $exception = null` instead of `\Exception $exception = null` in Symfony 5.0.
|
|
||||||
* Deprecated methods `ExceptionEvent::get/setException()`, use `get/setThrowable()` instead
|
|
||||||
* Deprecated class `ExceptionListener`, use `ErrorListener` instead
|
|
||||||
|
|
||||||
Lock
|
|
||||||
----
|
|
||||||
|
|
||||||
* Deprecated `Symfony\Component\Lock\StoreInterface` in favor of `Symfony\Component\Lock\BlockingStoreInterface` and
|
|
||||||
`Symfony\Component\Lock\PersistingStoreInterface`.
|
|
||||||
* `Factory` is deprecated, use `LockFactory` instead
|
|
||||||
* Deprecated services `lock.store.flock`, `lock.store.semaphore`, `lock.store.memcached.abstract` and `lock.store.redis.abstract`,
|
|
||||||
use `StoreFactory::createStore` instead.
|
|
||||||
|
|
||||||
Mailer
|
|
||||||
------
|
|
||||||
|
|
||||||
* [BC BREAK] Changed the DSN to use for disabling delivery (using the `NullTransport`) from `smtp://null` to `null://null` (host doesn't matter).
|
|
||||||
* [BC BREAK] Renamed class `SmtpEnvelope` to `Envelope` and `DelayedSmtpEnvelope` to `DelayedEnvelope`.
|
|
||||||
* [BC BREAK] Added a required `string $transport` argument to `MessageEvent::__construct`.
|
|
||||||
|
|
||||||
Messenger
|
|
||||||
---------
|
|
||||||
|
|
||||||
* [BC BREAK] Removed `SendersLocatorInterface::getSenderByAlias` added in 4.3.
|
|
||||||
* [BC BREAK] Removed `$retryStrategies` argument from `Worker::__construct`.
|
|
||||||
* [BC BREAK] Changed arguments of `ConsumeMessagesCommand::__construct`.
|
|
||||||
* [BC BREAK] Removed `$senderClassOrAlias` argument from `RedeliveryStamp::__construct`.
|
|
||||||
* [BC BREAK] Removed `UnknownSenderException`.
|
|
||||||
* [BC BREAK] Removed `WorkerInterface`.
|
|
||||||
* [BC BREAK] Removed `$onHandledCallback` of `Worker::run(array $options = [], callable $onHandledCallback = null)`.
|
|
||||||
* [BC BREAK] Removed `StopWhenMemoryUsageIsExceededWorker` in favor of `StopWorkerOnMemoryLimitListener`.
|
|
||||||
* [BC BREAK] Removed `StopWhenMessageCountIsExceededWorker` in favor of `StopWorkerOnMessageLimitListener`.
|
|
||||||
* [BC BREAK] Removed `StopWhenTimeLimitIsReachedWorker` in favor of `StopWorkerOnTimeLimitListener`.
|
|
||||||
* [BC BREAK] Removed `StopWhenRestartSignalIsReceived` in favor of `StopWorkerOnRestartSignalListener`.
|
|
||||||
* Marked the `MessengerDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
Mime
|
|
||||||
----
|
|
||||||
|
|
||||||
* Removed `NamedAddress`, use `Address` instead (which supports a name now)
|
|
||||||
|
|
||||||
MonologBridge
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* The `RouteProcessor` has been marked final.
|
|
||||||
|
|
||||||
Process
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated the `Process::inheritEnvironmentVariables()` method: env variables are always inherited.
|
|
||||||
|
|
||||||
PropertyAccess
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* Deprecated passing `null` as 2nd argument of `PropertyAccessor::createCache()` method (`$defaultLifetime`), pass `0` instead.
|
|
||||||
|
|
||||||
Routing
|
|
||||||
-------
|
|
||||||
|
|
||||||
* Deprecated `ServiceRouterLoader` in favor of `ContainerLoader`.
|
|
||||||
* Deprecated `ObjectRouteLoader` in favor of `ObjectLoader`.
|
|
||||||
|
|
||||||
Security
|
|
||||||
--------
|
|
||||||
|
|
||||||
* The `LdapUserProvider` class has been deprecated, use `Symfony\Component\Ldap\Security\LdapUserProvider` instead.
|
|
||||||
* Implementations of `PasswordEncoderInterface` and `UserPasswordEncoderInterface` should add a new `needsRehash()` method
|
|
||||||
* Deprecated returning a non-boolean value when implementing `Guard\AuthenticatorInterface::checkCredentials()`. Please explicitly return `false` to indicate invalid credentials.
|
|
||||||
* The `ListenerInterface` is deprecated, extend `AbstractListener` instead.
|
|
||||||
* Deprecated passing more than one attribute to `AccessDecisionManager::decide()` and `AuthorizationChecker::isGranted()` (and indirectly the `is_granted()` Twig and ExpressionLanguage function)
|
|
||||||
|
|
||||||
**Before**
|
|
||||||
```php
|
|
||||||
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**After**
|
|
||||||
```php
|
|
||||||
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')
|
|
||||||
) {}
|
|
||||||
```
|
|
||||||
|
|
||||||
SecurityBundle
|
|
||||||
--------------
|
|
||||||
|
|
||||||
* Marked the `SecurityDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
Serializer
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Deprecated the `XmlEncoder::TYPE_CASE_ATTRIBUTES` constant. Use `XmlEncoder::TYPE_CAST_ATTRIBUTES` instead.
|
|
||||||
|
|
||||||
Stopwatch
|
|
||||||
---------
|
|
||||||
|
|
||||||
* Deprecated passing `null` as 1st (`$id`) argument of `Section::get()` method, pass a valid child section identifier instead.
|
|
||||||
|
|
||||||
Translation
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* Deprecated support for using `null` as the locale in `Translator`.
|
|
||||||
* Deprecated accepting STDIN implicitly when using the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit.
|
|
||||||
* Marked the `TranslationDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
TwigBridge
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the
|
|
||||||
`DebugCommand::__construct()` method, swap the variables position.
|
|
||||||
* Deprecated accepting STDIN implicitly when using the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit.
|
|
||||||
* Marked the `TwigDataCollector` class as `@final`.
|
|
||||||
|
|
||||||
TwigBundle
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Deprecated `twig.exception_controller` configuration option.
|
|
||||||
|
|
||||||
If you were not using this option previously, set it to `null`:
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
twig:
|
|
||||||
exception_controller: null
|
|
||||||
```
|
|
||||||
|
|
||||||
If you were using this option previously, set it to `null` and use `framework.error_controller` instead:
|
|
||||||
|
|
||||||
Before:
|
|
||||||
```yaml
|
|
||||||
twig:
|
|
||||||
exception_controller: 'App\Controller\MyExceptionController'
|
|
||||||
```
|
|
||||||
|
|
||||||
After:
|
|
||||||
```yaml
|
|
||||||
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` and `txt` formats:
|
|
||||||
|
|
||||||
Before (HTTP status code `200`):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"error": {
|
|
||||||
"code": 404,
|
|
||||||
"message": "Sorry, the page you are looking for could not be found"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After (HTTP status code `404`):
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"title": "Not Found",
|
|
||||||
"status": 404,
|
|
||||||
"detail": "Sorry, the page you are looking for could not be found"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
* Deprecated the `ExceptionController` and `PreviewErrorController` controllers, use `ErrorController` 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`):
|
|
||||||
```twig
|
|
||||||
{
|
|
||||||
"type": "https://example.com/error",
|
|
||||||
"title": "{{ status_text }}",
|
|
||||||
"status": {{ status_code }}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
After (`App\Serializer\ProblemJsonNormalizer`):
|
|
||||||
```php
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Validator
|
|
||||||
---------
|
|
||||||
|
|
||||||
* [BC BREAK] Using null as `$classValidatorRegexp` value in `DoctrineLoader::__construct` or `PropertyInfoLoader::__construct` will not enable auto-mapping for all classes anymore, use `'{.*}'` instead.
|
|
||||||
* Deprecated passing an `ExpressionLanguage` instance as the second argument of `ExpressionValidator::__construct()`.
|
|
||||||
* Deprecated using anything else than a `string` as the code of a `ConstraintViolation`, a `string` type-hint will
|
|
||||||
be added to the constructor of the `ConstraintViolation` class and to the `ConstraintViolationBuilder::setCode()`
|
|
||||||
method in 5.0.
|
|
||||||
* Deprecated passing an `ExpressionLanguage` instance as the second argument of `ExpressionValidator::__construct()`.
|
|
||||||
Pass it as the first argument instead.
|
|
||||||
* The `Length` constraint expects the `allowEmptyString` option to be defined
|
|
||||||
when the `min` option is used.
|
|
||||||
Set it to `true` to keep the current behavior and `false` to reject empty strings.
|
|
||||||
In 5.0, it'll become optional and will default to `false`.
|
|
||||||
* Overriding the methods `ConstraintValidatorTestCase::setUp()` and `ConstraintValidatorTestCase::tearDown()` without the `void` return-type is deprecated.
|
|
||||||
* deprecated `Symfony\Component\Validator\Mapping\Cache\CacheInterface` and all implementations in favor of PSR-6.
|
|
||||||
* deprecated `ValidatorBuilder::setMetadataCache`, use `ValidatorBuilder::setMappingCache` instead.
|
|
||||||
* The `Range` constraint has a new message option `notInRangeMessage` that is used when both `min` and `max` 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`.
|
|
||||||
|
|
||||||
WebProfilerBundle
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
* Deprecated the `ExceptionController` class in favor of `ExceptionErrorController`
|
|
||||||
* Deprecated the `TemplateManager::templateExists()` method
|
|
||||||
|
|
||||||
WebServerBundle
|
|
||||||
---------------
|
|
||||||
|
|
||||||
* The bundle is deprecated and will be removed in 5.0.
|
|
||||||
|
|
||||||
Yaml
|
|
||||||
----
|
|
||||||
|
|
||||||
* Deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit.
|
|
@ -1,4 +1,4 @@
|
|||||||
UPGRADE FROM 4.x to 5.0
|
UPGRADE FROM 4.4 to 5.0
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
BrowserKit
|
BrowserKit
|
||||||
|
Reference in New Issue
Block a user