This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/UPGRADE-5.2.md
Fabien Potencier 32941f22d1 feature #36691 [FrameworkBundle] Deprecate some public services to private (fancyweb)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[FrameworkBundle] Deprecate some public services to private

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | -
| License       | MIT
| Doc PR        | -

Now that we can deprecate public services to private, here is a first pass on the FWB. I think all those services don't need to be public, ie we never need to access them directly in Symfony's code (except in some tests that I had to modify accordingly). I think most of theses services needed to be public before we hooked the AbstractController with a service subscriber. There are definitely more of them that can be deprecated (ie: created workflows and state machines are public but don't need to be ?) but let's start with the easy ones.

Commits
-------

87868baacb [FrameworkBundle] Deprecate some public services to private
2020-07-31 09:12:35 +02:00

63 lines
1.3 KiB
Markdown

UPGRADE FROM 5.1 to 5.2
=======================
DependencyInjection
-------------------
* Deprecated `Definition::setPrivate()` and `Alias::setPrivate()`, use `setPublic()` instead
FrameworkBundle
---------------
* Deprecated the public `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
`cache_clearer`, `filesystem` and `validator` services to private.
Mime
----
* Deprecated `Address::fromString()`, use `Address::create()` instead
TwigBundle
----------
* Deprecated the public `twig` service to private.
TwigBridge
----------
* Changed 2nd argument type of `TranslationExtension::__construct()` to `TranslationNodeVisitor`
Validator
---------
* Deprecated the `allowEmptyString` option of the `Length` constraint.
Before:
```php
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\Length(min=5, allowEmptyString=true)
*/
```
After:
```php
use Symfony\Component\Validator\Constraints as Assert;
/**
* @Assert\AtLeastOneOf({
* @Assert\Blank(),
* @Assert\Length(min=5)
* })
*/
```
Security
--------
* [BC break] In the experimental authenticator-based system, * `TokenInterface::getUser()`
returns `null` in case of unauthenticated session.