From 34a2ac6da6ff8f8023e2939c3c2c0cbb84f03f8e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 12 Apr 2020 15:08:12 +0200 Subject: [PATCH] Remove UPGRADE files for 4.x --- UPGRADE-4.0.md | 1144 ------------------------------------------------ UPGRADE-4.1.md | 164 ------- UPGRADE-4.2.md | 393 ----------------- UPGRADE-4.3.md | 358 --------------- UPGRADE-4.4.md | 396 ----------------- UPGRADE-5.0.md | 2 +- 6 files changed, 1 insertion(+), 2456 deletions(-) delete mode 100644 UPGRADE-4.0.md delete mode 100644 UPGRADE-4.1.md delete mode 100644 UPGRADE-4.2.md delete mode 100644 UPGRADE-4.3.md delete mode 100644 UPGRADE-4.4.md diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md deleted file mode 100644 index fa37fba3a1..0000000000 --- a/UPGRADE-4.0.md +++ /dev/null @@ -1,1144 +0,0 @@ -UPGRADE FROM 3.x to 4.0 -======================= - -Symfony Framework ------------------ - -The first step to upgrade a Symfony 3.x application to 4.x is to update the -file and directory structure of your application: - -| Symfony 3.x | Symfony 4.x -| ----------------------------------- | -------------------------------- -| `app/config/` | `config/` -| `app/config/*.yml` | `config/*.yaml` and `config/packages/*.yaml` -| `app/config/parameters.yml.dist` | `config/services.yaml` and `.env.dist` -| `app/config/parameters.yml` | `config/services.yaml` and `.env` -| `app/Resources//views/` | `templates/bundles//` -| `app/Resources/` | `src/Resources/` -| `app/Resources/assets/` | `assets/` -| `app/Resources/translations/` | `translations/` -| `app/Resources/views/` | `templates/` -| `src/AppBundle/` | `src/` -| `var/logs/` | `var/log/` -| `web/` | `public/` -| `web/app.php` | `public/index.php` -| `web/app_dev.php` | `public/index.php` - -Then, upgrade the contents of your console script and your front controller: - -* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/4.4/bin/console -* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.4/public/index.php - -Lastly, read the following article to add Symfony Flex to your application and -upgrade the configuration files: https://symfony.com/doc/current/setup/flex.html - -If you use Symfony components instead of the whole framework, you can find below -the upgrading instructions for each individual bundle and component. - -ClassLoader ------------ - - * The component has been removed. Use Composer instead. - -Config ------- - - * The protected `TreeBuilder::$builder` property has been removed. - -Console -------- - - * Setting unknown style options is not supported anymore and throws an - exception. - - * The `QuestionHelper::setInputStream()` method is removed. Use - `StreamableInputInterface::setStream()` or `CommandTester::setInputs()` - instead. - - Before: - - ```php - $input = new ArrayInput(); - - $questionHelper->setInputStream($stream); - $questionHelper->ask($input, $output, $question); - ``` - - After: - - ```php - $input = new ArrayInput(); - $input->setStream($stream); - - $questionHelper->ask($input, $output, $question); - ``` - - Before: - - ```php - $commandTester = new CommandTester($command); - - $stream = fopen('php://memory', 'r+', false); - fputs($stream, "AppBundle\nYes"); - rewind($stream); - - $command->getHelper('question')->setInputStream($stream); - - $commandTester->execute(); - ``` - - After: - - ```php - $commandTester = new CommandTester($command); - - $commandTester->setInputs(['AppBundle', 'Yes']); - - $commandTester->execute(); - ``` - - * The `console.exception` event and the related `ConsoleExceptionEvent` class have - been removed in favor of the `console.error` event and the `ConsoleErrorEvent` class. - - * The `SymfonyQuestionHelper::ask` default validation has been removed in favor of `Question::setValidator`. - -Debug ------ - - - * The `ContextErrorException` class has been removed. Use `\ErrorException` instead. - - * `FlattenException::getTrace()` now returns additional type descriptions - `integer` and `float`. - - * Support for stacked errors in the `ErrorHandler` has been removed - -DependencyInjection -------------------- - - * Definitions and aliases are now private by default in 4.0. You should either use service injection - or explicitly define your services as public if you really need to inject the container. - - * Relying on service auto-registration while autowiring is not supported anymore. - Explicitly inject your dependencies or create services whose ids are - their fully-qualified class name. - - Before: - - ```php - namespace App\Controller; - - use App\Mailer; - - class DefaultController - { - public function __construct(Mailer $mailer) { - // ... - } - - // ... - } - ``` - ```yml - services: - App\Controller\DefaultController: - autowire: true - ``` - - After: - - ```php - // same PHP code - ``` - ```yml - services: - App\Controller\DefaultController: - autowire: true - - # or - # App\Controller\DefaultController: - # arguments: { $mailer: "@App\Mailer" } - - App\Mailer: - autowire: true - ``` - - * Autowiring services based on the types they implement is not supported anymore. - It will only look for an alias or a service id that matches a given FQCN. - Rename (or alias) your services to their FQCN id to make them autowirable. - In 3.4, you can activate this behavior instead of having deprecation messages - by setting the following parameter: - - ```yml - parameters: - container.autowiring.strict_mode: true - ``` - - From 4.0, you can remove it as it's the default behavior and the parameter is not handled anymore. - - * `_defaults` and `_instanceof` are now reserved service names in Yaml configurations. Please rename any services with that names. - - * Non-numeric keys in methods and constructors arguments have never been supported and are now forbidden. Please remove them if you happen to have one. - - * Service names that start with an underscore are now reserved in Yaml files. Please rename any services with such names. - - * Autowiring-types have been removed, use aliases instead. - - Before: - - ```xml - - Doctrine\Common\Annotations\Reader - - ``` - - After: - - ```xml - - - ``` - - * Service identifiers and parameter names are now case sensitive. - - * The `Reference` and `Alias` classes do not make service identifiers lowercase anymore. - - * Using the `PhpDumper` with an uncompiled `ContainerBuilder` is not supported - anymore. - - * Extending the containers generated by `PhpDumper` is not supported - anymore. - - * The `DefinitionDecorator` class has been removed. Use the `ChildDefinition` - class instead. - - * The `ResolveDefinitionTemplatesPass` class has been removed. - Use the `ResolveChildDefinitionsPass` class instead. - - * Using unsupported configuration keys in YAML configuration files raises an - exception. - - * Using unsupported options to configure service aliases raises an exception. - - * Setting or unsetting a service with the `Container::set()` method is - no longer supported. Only synthetic services can be set or unset. - - * Checking the existence of a private service with the `Container::has()` - method is no longer supported and will return `false`. - - * Requesting a private service with the `Container::get()` method is no longer - supported. - - * The ``strict`` attribute in service arguments has been removed. - The attribute is ignored since 3.0, you can remove it. - - * Top-level anonymous services in XML are no longer supported. - - * The `ExtensionCompilerPass` has been moved to before-optimization passes with priority -1000. - - * In 3.4, parameter `container.dumper.inline_class_loader` was introduced. Unless - you're using a custom autoloader, you should enable this parameter. This can - drastically improve DX by reducing the time to load classes when the `DebugClassLoader` - is enabled. If you're using `FrameworkBundle`, this performance improvement will - also impact the "dev" environment: - - ```yml - parameters: - container.dumper.inline_class_loader: true - ``` - -DoctrineBridge --------------- - -* The `Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandler` and - `Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionHandlerSchema` have been removed. Use - `Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler` instead. - -EventDispatcher ---------------- - - * The `ContainerAwareEventDispatcher` class has been removed. - Use `EventDispatcher` with closure factories instead. - - * The `reset()` method has been added to `TraceableEventDispatcherInterface`. - -ExpressionLanguage ------------------- - - * The ability to pass a `ParserCacheInterface` instance to the `ExpressionLanguage` - class has been removed. You should use the `CacheItemPoolInterface` interface - instead. - -Filesystem ----------- - - * The `Symfony\Component\Filesystem\LockHandler` has been removed, - use the `Symfony\Component\Lock\Store\FlockStore` class - or the `Symfony\Component\Lock\Store\FlockStore\SemaphoreStore` class directly instead. - * Support for passing relative paths to `Filesystem::makePathRelative()` has been removed. - -Finder ------- - - * The `ExceptionInterface` has been removed. - * The `Symfony\Component\Finder\Iterator\FilterIterator` class has been - removed as it used to fix a bug which existed before version 5.5.23/5.6.7 - -Form ----- - -* The values of the `FormEvents::*` constants have been updated to match the - constant names. You should only update your application if you relied on the - constant values instead of their names. - - * The `choices_as_values` option of the `ChoiceType` has been removed. - - * Support for data objects that implements both `Traversable` and - `ArrayAccess` in `ResizeFormListener::preSubmit` method has been removed. - - * Using callable strings as choice options in ChoiceType is not supported - anymore. - - Before: - - ```php - 'choice_label' => 'strtoupper', - ``` - - After: - - ```php - 'choice_label' => function ($choice) { - return strtoupper($choice); - }, - ``` - - * Caching of the loaded `ChoiceListInterface` in the `LazyChoiceList` has been removed, - it must be cached in the `ChoiceLoaderInterface` implementation instead. - - * Calling `isValid()` on a `Form` instance before submitting it is not supported - anymore and raises an exception. - - Before: - - ```php - if ($form->isValid()) { - // ... - } - ``` - - After: - - ```php - if ($form->isSubmitted() && $form->isValid()) { - // ... - } - ``` - - * Using the "choices" option in ``CountryType``, ``CurrencyType``, ``LanguageType``, - ``LocaleType``, and ``TimezoneType`` without overriding the ``choice_loader`` - option is now ignored. - - Before: - ```php - $builder->add('custom_locales', LocaleType::class, [ - 'choices' => $availableLocales, - ]); - ``` - - After: - ```php - $builder->add('custom_locales', LocaleType::class, [ - 'choices' => $availableLocales, - 'choice_loader' => null, - ]); - // or - $builder->add('custom_locales', LocaleType::class, [ - 'choice_loader' => new CallbackChoiceLoader(function () { - return $this->getAvailableLocales(); - }), - ]); - ``` - - * Removed `ChoiceLoaderInterface` implementation in `TimezoneType`. Use the "choice_loader" option instead. - - Before: - ```php - class MyTimezoneType extends TimezoneType - { - public function loadChoiceList() - { - // override the method - } - } - ``` - - After: - ```php - class MyTimezoneType extends AbstractType - { - public function getParent() - { - return TimezoneType::class; - } - - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefault('choice_loader', ...); // override the option instead - } - } - ``` - - * `FormRendererInterface::setTheme` and `FormRendererEngineInterface::setTheme` have a new optional argument `$useDefaultThemes` with a default value set to `true`. - -FrameworkBundle ---------------- - - * The `session.use_strict_mode` option has been removed and strict mode is always enabled. - - * The `validator.mapping.cache.doctrine.apc` service has been removed. - - * The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been removed. Use the `Request::setTrustedProxies()` method in your front controller instead. - - * The default value of the `framework.workflows.[name].type` configuration options is now `state_machine`. - - * Support for absolute template paths has been removed. - - * The following form types registered as services have been removed; use their - fully-qualified class name instead: - - - `"form.type.birthday"` - - `"form.type.checkbox"` - - `"form.type.collection"` - - `"form.type.country"` - - `"form.type.currency"` - - `"form.type.date"` - - `"form.type.datetime"` - - `"form.type.email"` - - `"form.type.file"` - - `"form.type.hidden"` - - `"form.type.integer"` - - `"form.type.language"` - - `"form.type.locale"` - - `"form.type.money"` - - `"form.type.number"` - - `"form.type.password"` - - `"form.type.percent"` - - `"form.type.radio"` - - `"form.type.range"` - - `"form.type.repeated"` - - `"form.type.search"` - - `"form.type.textarea"` - - `"form.type.text"` - - `"form.type.time"` - - `"form.type.timezone"` - - `"form.type.url"` - - `"form.type.button"` - - `"form.type.submit"` - - `"form.type.reset"` - - * The `framework.serializer.cache` option and the services - `serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc` - have been removed. APCu should now be automatically used when available. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CompilerDebugDumpPass` has been removed. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been removed. - Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass` class has been removed. - Use the `Symfony\Component\Serializer\DependencyInjection\SerializerPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass` class has been - removed. Use the `Symfony\Component\Form\DependencyInjection\FormPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\EventListener\SessionListener` class has been removed. - Use the `Symfony\Component\HttpKernel\EventListener\SessionListener` class instead. - - * The `Symfony\Bundle\FrameworkBundle\EventListener\TestSessionListener` class has been - removed. Use the `Symfony\Component\HttpKernel\EventListener\TestSessionListener` - class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass` class has been removed. - Use tagged iterator arguments instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass` class has been - removed. Use the `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass` - class instead. - - * Class parameters related to routing have been removed - * router.options.generator_class - * router.options.generator_base_class - * router.options.generator_dumper_class - * router.options.matcher_class - * router.options.matcher_base_class - * router.options.matcher_dumper_class - * router.options.matcher.cache_class - * router.options.generator.cache_class - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ControllerArgumentValueResolverPass` class - has been removed. Use the `Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass` - class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass` - class has been removed. Use the - `Symfony\Component\Routing\DependencyInjection\RoutingResolverPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\Translation\Translator` constructor now takes the - default locale as mandatory 3rd argument. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddValidatorInitializersPass` class has been - removed. Use the `Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass` - class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass` class has been - removed. Use the `Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` - class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass` class - has been removed. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` - class instead. - - * Using the `KERNEL_DIR` environment variable and the automatic guessing based - on the `phpunit.xml` file location have been removed from the `KernelTestCase::getKernelClass()` - method implementation. Set the `KERNEL_CLASS` environment variable to the - fully-qualified class name of your Kernel or override the `KernelTestCase::createKernel()` - or `KernelTestCase::getKernelClass()` method instead. - - * The methods `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` - have been removed. - - * The `Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory` class has been removed. - Use `Symfony\Component\Validator\ContainerConstraintValidatorFactory` instead. - - * The `--no-prefix` option of the `translation:update` command has - been removed. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass` class has been removed. - Use tagged iterator arguments instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass` class has been removed. - Use tagged iterator arguments instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass` - class has been removed. Use the - `Symfony\Component\Translation\DependencyInjection\TranslationDumperPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass` - class has been removed. Use the - `Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass` - class has been removed. Use the - `Symfony\Component\Translation\DependencyInjection\TranslatorPass` class instead. - - * The `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader` - class has been deprecated and will be removed in 4.0. Use the - `Symfony\Component\Translation\Reader\TranslationReader` class instead. - - * The `translation.loader` service has been removed. - Use the `translation.reader` service instead. - - * `AssetsInstallCommand::__construct()` now requires an instance of - `Symfony\Component\Filesystem\Filesystem` as first argument. - - * `CacheClearCommand::__construct()` now requires an instance of - `Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface` as - first argument. - - * `CachePoolClearCommand::__construct()` now requires an instance of - `Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer` as - first argument. - - * `EventDispatcherDebugCommand::__construct()` now requires an instance of - `Symfony\Component\EventDispatcher\EventDispatcherInterface` as - first argument. - - * `RouterDebugCommand::__construct()` now requires an instance of - `Symfony\Component\Routing\RouterInterface` as - first argument. - - * `RouterMatchCommand::__construct()` now requires an instance of - `Symfony\Component\Routing\RouterInterface` as - first argument. - - * `TranslationDebugCommand::__construct()` now requires an instance of - `Symfony\Component\Translation\TranslatorInterface` as - first argument. - - * `TranslationUpdateCommand::__construct()` now requires an instance of - `Symfony\Component\Translation\TranslatorInterface` as - first argument. - - * The `Symfony\Bundle\FrameworkBundle\Translation\PhpExtractor` - class has been deprecated and will be removed in 4.0. Use the - `Symfony\Component\Translation\Extractor\PhpExtractor` class instead. - - * The `Symfony\Bundle\FrameworkBundle\Translation\PhpStringTokenParser` - class has been deprecated and will be removed in 4.0. Use the - `Symfony\Component\Translation\Extractor\PhpStringTokenParser` class instead. - -HttpFoundation --------------- - - * The `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument. - See http://symfony.com/doc/current/components/http_foundation/trusting_proxies.html for more info. - - * The `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods have been removed. - - * Extending the following methods of `Response` - is no longer possible (these methods are now `final`): - - - `setDate`/`getDate` - - `setExpires`/`getExpires` - - `setLastModified`/`getLastModified` - - `setProtocolVersion`/`getProtocolVersion` - - `setStatusCode`/`getStatusCode` - - `setCharset`/`getCharset` - - `setPrivate`/`setPublic` - - `getAge` - - `getMaxAge`/`setMaxAge` - - `setSharedMaxAge` - - `getTtl`/`setTtl` - - `setClientTtl` - - `getEtag`/`setEtag` - - `hasVary`/`getVary`/`setVary` - - `isInvalid`/`isSuccessful`/`isRedirection`/`isClientError`/`isServerError` - - `isOk`/`isForbidden`/`isNotFound`/`isRedirect`/`isEmpty` - - * The ability to check only for cacheable HTTP methods using `Request::isMethodSafe()` is - not supported anymore, use `Request::isMethodCacheable()` instead. - - * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler` class has been - removed. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead. - - * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler` and - `Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy` classes have been removed. - - * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` does not work with the legacy - mongo extension anymore. It requires mongodb/mongodb package and ext-mongodb. - - * The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler` class has been removed. - Use `Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler` instead. - -HttpKernel ----------- - - * Bundle inheritance has been removed. - - * Relying on convention-based commands discovery is not supported anymore. - Use PSR-4 based service discovery instead. - - Before: - - ```yml - # app/config/services.yml - services: - # ... - - # implicit registration of all commands in the `Command` folder - ``` - - After: - - ```yml - # app/config/services.yml - services: - # ... - - # explicit commands registration - AppBundle\Command\: - resource: '../../src/AppBundle/Command/*' - tags: ['console.command'] - ``` - - * The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been removed. - - * Possibility to pass non-scalar values as URI attributes to the ESI and SSI - renderers has been removed. The inline fragment renderer should be used with - non-scalar attributes. - - * The `ControllerResolver::getArguments()` method has been removed. If you - have your own `ControllerResolverInterface` implementation, you should - inject an `ArgumentResolverInterface` instance. - - * The `DataCollector::varToString()` method has been removed in favor of `cloneVar()`. - - * The `Psr6CacheClearer::addPool()` method has been removed. Pass an array of pools indexed - by name to the constructor instead. - - * The `LazyLoadingFragmentHandler::addRendererService()` method has been removed. - - * The `X-Status-Code` header method of setting a custom status code in the - response when handling exceptions has been removed. There is now a new - `GetResponseForExceptionEvent::allowCustomResponseCode()` method instead, - which will tell the Kernel to use the response code set on the event's - response object. - - * The `Kernel::getEnvParameters()` method has been removed. - - * The `SYMFONY__` environment variables are no longer processed automatically - by Symfony. Use the `%env()%` syntax to get the value of any environment - variable from configuration files instead. - - * The `getCacheDir()` method of your kernel should not be called while building the container. - Use the `%kernel.cache_dir%` parameter instead. Not doing so may break the `cache:clear` command. - - * The `Symfony\Component\HttpKernel\Config\EnvParametersResource` class has been removed. - - * The `reset()` method has been added to `Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface`. - - * The `clear()` method has been added to `Symfony\Component\HttpKernel\Log\DebugLoggerInterface`. - - * The `ChainCacheClearer::add()` method has been removed, - inject the list of clearers as a constructor argument instead. - - * The `CacheWarmerAggregate::add()` and `setWarmers()` methods have been removed, - inject the list of clearers as a constructor argument instead. - - * The `CacheWarmerAggregate` and `ChainCacheClearer` classes have been made final. - -Ldap ----- - - * The `RenameEntryInterface` has been removed, and merged with `EntryManagerInterface` - -Process -------- - - * Passing a not existing working directory to the constructor of the `Symfony\Component\Process\Process` class is not supported anymore. - - * The `Symfony\Component\Process\ProcessBuilder` class has been removed, - use the `Symfony\Component\Process\Process` class directly instead. - - * The `ProcessUtils::escapeArgument()` method has been removed, use a command line array or give env vars to the `Process::start/run()` method instead. - - * Environment variables are always inherited in sub-processes. - - * Configuring `proc_open()` options has been removed. - - * Configuring Windows and sigchild compatibility is not possible anymore - they are always enabled. - - * Extending `Process::run()`, `Process::mustRun()` and `Process::restart()` is - not supported anymore. - - * The `getEnhanceWindowsCompatibility()` and `setEnhanceWindowsCompatibility()` methods of the `Process` class have been removed. - -Profiler --------- - - * The `profiler.matcher` option has been removed. - -ProxyManager ------------- - - * The `ProxyDumper` class has been made final - -Security --------- - - * The `RoleInterface` has been removed. Extend the `Symfony\Component\Security\Core\Role\Role` - class instead. - - * The `LogoutUrlGenerator::registerListener()` method expects a 6th `string $context = null` argument. - - * The `AccessDecisionManager::setVoters()` method has been removed. Pass the - voters to the constructor instead. - - * Support for defining voters that don't implement the `VoterInterface` has been removed. - - * Calling `ContextListener::setLogoutOnUserChange(false)` won't have any - effect anymore. - - * Removed the HTTP digest authentication system. The `NonceExpiredException`, - `DigestAuthenticationListener` and `DigestAuthenticationEntryPoint` classes - have been removed. Use another authentication system like `http_basic` instead. - - * The `GuardAuthenticatorInterface` interface has been removed. - Use `AuthenticatorInterface` instead. - - * When extending `AbstractGuardAuthenticator` getCredentials() cannot return - `null` anymore, return false from `supports()` if no credentials available instead. - -SecurityBundle --------------- - - * The `FirewallContext::getContext()` method has been removed, use the `getListeners()` and/or `getExceptionListener()` method instead. - - * The `FirewallMap::$map` and `$container` properties have been removed. - - * The `UserPasswordEncoderCommand` class does not allow `null` as the first argument anymore. - - * `UserPasswordEncoderCommand` does not extend `ContainerAwareCommand` nor implement `ContainerAwareInterface` anymore. - - * `InitAclCommand` has been removed. Use `Symfony\Bundle\AclBundle\Command\InitAclCommand` instead - - * `SetAclCommand` has been removed. Use `Symfony\Bundle\AclBundle\Command\SetAclCommand` instead - - * The firewall option `logout_on_user_change` is now always true, which will - trigger a logout if the user changes between requests. - - * Removed the HTTP digest authentication system. The `HttpDigestFactory` class - has been removed. Use another authentication system like `http_basic` instead. - - * The `switch_user.stateless` option is now always true if the firewall is stateless. - - * Not configuring explicitly the provider on a firewall is ambiguous when there is more than one registered provider. - The first configured provider is not used anymore and an exception is thrown instead. - Explicitly configure the provider to use on your firewalls. - -Serializer ----------- - - * The ability to pass a Doctrine `Cache` instance to the `ClassMetadataFactory` - class has been removed. You should use the `CacheClassMetadataFactory` class - instead. - - * Not defining the 6th argument `$format = null` of the - `AbstractNormalizer::instantiateObject()` method when overriding it is not - supported anymore. - - * Extending `ChainDecoder`, `ChainEncoder`, `ArrayDenormalizer` is not supported - anymore. - -Translation ------------ - - * Removed the backup feature from the file dumper classes. - - * The default value of the `$readerServiceId` argument of `TranslatorPass::__construct()` has been changed to `"translation.reader"`. - - * Removed `Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations`, - use `Symfony\Component\Translation\Writer\TranslationWriter::write` instead. - - * Removed support for passing `Symfony\Component\Translation\MessageSelector` as a second argument to the - `Translator::__construct()`. You should pass an instance of `Symfony\Component\Translation\Formatter\MessageFormatterInterface` instead. - -TwigBundle ----------- - -* The `ContainerAwareRuntimeLoader` class has been removed. Use the - Twig `Twig_ContainerRuntimeLoader` class instead. - - * Removed `DebugCommand` in favor of `Symfony\Bridge\Twig\Command\DebugCommand`. - - * Removed `ContainerAwareInterface` implementation in `Symfony\Bundle\TwigBundle\Command\LintCommand`. - -TwigBridge ----------- - - * removed the `Symfony\Bridge\Twig\Form\TwigRenderer` class, use the `FormRenderer` - class from the Form component instead - - * Removed the possibility to inject the Form `TwigRenderer` into the `FormExtension`. - Upgrade Twig to `^1.30`, inject the `Twig_Environment` into the `TwigRendererEngine` and load - the `TwigRenderer` using the `Twig_FactoryRuntimeLoader` instead. - - Before: - - ```php - use Symfony\Bridge\Twig\Extension\FormExtension; - use Symfony\Bridge\Twig\Form\TwigRenderer; - use Symfony\Bridge\Twig\Form\TwigRendererEngine; - - // ... - $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig']); - $rendererEngine->setEnvironment($twig); - $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager))); - ``` - - After: - - ```php - $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig'], $twig); - $twig->addRuntimeLoader(new \Twig_FactoryRuntimeLoader([ - TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) { - return new TwigRenderer($rendererEngine, $csrfTokenManager); - }, - ])); - $twig->addExtension(new FormExtension()); - ``` - - * Removed the `TwigRendererEngineInterface` interface. - - * The `TwigRendererEngine::setEnvironment()` method has been removed. - Pass the Twig Environment as second argument of the constructor instead. - - * Removed `DebugCommand::set/getTwigEnvironment`. Pass an instance of - `Twig\Environment` as first argument of the constructor instead. - - * Removed `LintCommand::set/getTwigEnvironment`. Pass an instance of - `Twig\Environment` as first argument of the constructor instead. - - -Validator ---------- - - * The default value of the `strict` option of the `Choice` constraint was changed - to `true`. Using any other value will throw an exception. - - * The `DateTimeValidator::PATTERN` constant was removed. - - * `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in - favor of `Test\ConstraintValidatorTestCase`. - - Before: - - ```php - // ... - use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest; - - class MyCustomValidatorTest extends AbstractConstraintValidatorTest - { - // ... - } - ``` - - After: - - ```php - // ... - use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; - - class MyCustomValidatorTest extends ConstraintValidatorTestCase - { - // ... - } - ``` - - * Setting the `checkDNS` option of the `Url` constraint to `true` is dropped - in favor of `Url::CHECK_DNS_TYPE_*` constants values. - - Before: - - ```php - $constraint = new Url(['checkDNS' => true]); - ``` - - After: - - ```php - $constraint = new Url(['checkDNS' => Url::CHECK_DNS_TYPE_ANY]); - ``` - -VarDumper ---------- - - * The `VarDumperTestTrait::assertDumpEquals()` method expects a 3rd `$filter = 0` - argument and moves `$message = ''` argument at 4th position. - - Before: - - ```php - VarDumperTestTrait::assertDumpEquals($dump, $data, $message = ''); - ``` - - After: - - ```php - VarDumperTestTrait::assertDumpEquals($dump, $data, $filter = 0, $message = ''); - ``` - - * The `VarDumperTestTrait::assertDumpMatchesFormat()` method expects a 3rd `$filter = 0` - argument and moves `$message = ''` argument at 4th position. - - Before: - - ```php - VarDumperTestTrait::assertDumpMatchesFormat($dump, $data, $message = ''); - ``` - - After: - - ```php - VarDumperTestTrait::assertDumpMatchesFormat($dump, $data, $filter = 0, $message = ''); - ``` - -WebProfilerBundle ------------------ - - * Removed the `getTemplates()` method of the `TemplateManager` class in favor - of the `getNames()` method - -Workflow --------- - - * Removed class name support in `WorkflowRegistry::add()` as second parameter. - -Yaml ----- - - * Support for the `!str` tag was removed, use the `!!str` tag instead. - - * Starting an unquoted string with a question mark followed by a space - throws a `ParseException`. - - * Removed support for implicitly parsing non-string mapping keys as strings. - Mapping keys that are no strings will result in a `ParseException`. Use - quotes to opt-in for keys to be parsed as strings. - - Before: - - ```php - $yaml = << new A(), 'bar' => 1], 0, 0, true); - ``` - - After: - - ```php - Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE); - ``` - - * Removed support for passing `true`/`false` as the fifth argument to the - `dump()` method to toggle object support. - - Before: - - ```php - Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, false, true); - ``` - - After: - - ```php - Yaml::dump(['foo' => new A(), 'bar' => 1], 0, 0, false, Yaml::DUMP_OBJECT); - ``` - - * The `!!php/object` tag to indicate dumped PHP objects was removed in favor of - the `!php/object` tag. - - * Duplicate mapping keys lead to a `ParseException`. - - * The constructor arguments `$offset`, `$totalNumberOfLines` and - `$skippedLineNumbers` of the `Parser` class were removed. - - * The behavior of the non-specific tag `!` is changed and now forces - non-evaluating your values. - - * The `!php/object:` tag was removed in favor of the `!php/object` tag (without - the colon). - - * The `!php/const:` tag was removed in favor of the `!php/const` tag (without - the colon). - - Before: - - ```yml - !php/const:PHP_INT_MAX - ``` - - After: - - ```yml - !php/const PHP_INT_MAX - ``` diff --git a/UPGRADE-4.1.md b/UPGRADE-4.1.md deleted file mode 100644 index 8410c67f84..0000000000 --- a/UPGRADE-4.1.md +++ /dev/null @@ -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. diff --git a/UPGRADE-4.2.md b/UPGRADE-4.2.md deleted file mode 100644 index 8f7cc54411..0000000000 --- a/UPGRADE-4.2.md +++ /dev/null @@ -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//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//views/`, use `templates/` and `templates/bundles//` 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 diff --git a/UPGRADE-4.3.md b/UPGRADE-4.3.md deleted file mode 100644 index 5093de27cb..0000000000 --- a/UPGRADE-4.3.md +++ /dev/null @@ -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. diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md deleted file mode 100644 index bcdee9ca13..0000000000 --- a/UPGRADE-4.4.md +++ /dev/null @@ -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. diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index fb773cc1b8..c0ebfb213a 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -1,4 +1,4 @@ -UPGRADE FROM 4.x to 5.0 +UPGRADE FROM 4.4 to 5.0 ======================= BrowserKit