Skip to content

Commit 465bc72

Browse files
minor #50870 Add more details to the UPGRADE guide (wouterj)
This PR was merged into the 7.0 branch. Discussion ---------- Add more details to the UPGRADE guide | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 322f23c Add more details to UPGRADE guide
2 parents 297569b + 322f23c commit 465bc72

File tree

1 file changed

+96
-3
lines changed

1 file changed

+96
-3
lines changed

UPGRADE-7.0.md

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ UPGRADE FROM 6.4 to 7.0
44
Symfony 6.4 and Symfony 7.0 will be released simultaneously at the end of November 2023. According to the Symfony
55
release process, both versions will have the same features, but Symfony 7.0 won't include any deprecated features.
66
To upgrade, make sure to resolve all deprecation notices.
7+
Read more about this in the [Symfony documentation](https://symfony.com/doc/current/setup/upgrade_major.html).
78

89
Cache
910
-----
@@ -14,6 +15,32 @@ Console
1415
-------
1516

1617
* Remove `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead
18+
19+
*Before*
20+
```php
21+
use Symfony\Component\Console\Command\Command;
22+
23+
class CreateUserCommand extends Command
24+
{
25+
protected static $defaultName = 'app:create-user';
26+
protected static $defaultDescription = 'Creates users';
27+
28+
// ...
29+
}
30+
```
31+
32+
*After*
33+
```php
34+
use Symfony\Component\Console\Attribute\AsCommand;
35+
use Symfony\Component\Console\Command\Command;
36+
37+
#[AsCommand(name: 'app:create-user', description: 'Creates users')]
38+
class CreateUserCommand extends Command
39+
{
40+
// ...
41+
}
42+
```
43+
1744
* Passing null to `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()` must be done explicitly
1845
* Remove `StringInput::REGEX_STRING`
1946
* Add method `__toString()` to `InputInterface`
@@ -128,17 +155,83 @@ Security
128155
SecurityBundle
129156
--------------
130157

131-
* Enabling SecurityBundle and not configuring it is not allowed
158+
* Enabling SecurityBundle and not configuring it is not allowed, either remove the bundle or configure at least one firewall
132159

133160
Serializer
134161
----------
135162

136163
* Add method `getSupportedTypes()` to `DenormalizerInterface` and `NormalizerInterface`
137164
* Remove denormalization support for `AbstractUid` in `UidNormalizer`, use one of `AbstractUid` child class instead
138165
* Denormalizing to an abstract class in `UidNormalizer` now throws an `\Error`
139-
* Remove `ContextAwareDenormalizerInterface`, use `DenormalizerInterface` instead
140-
* Remove `ContextAwareNormalizerInterface`, use `NormalizerInterface` instead
166+
* Remove `ContextAwareDenormalizerInterface` and `ContextAwareNormalizerInterface`, use `DenormalizerInterface` and `NormalizerInterface` instead
167+
168+
*Before*
169+
```php
170+
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
171+
172+
class TopicNormalizer implements ContextAwareNormalizerInterface
173+
{
174+
public function normalize($topic, string $format = null, array $context = [])
175+
{
176+
}
177+
}
178+
```
179+
180+
*After*
181+
```php
182+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
183+
184+
class TopicNormalizer implements NormalizerInterface
185+
{
186+
public function normalize($topic, string $format = null, array $context = [])
187+
{
188+
}
189+
}
190+
```
141191
* Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead
192+
193+
*Before*
194+
```php
195+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
196+
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
197+
198+
class TopicNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
199+
{
200+
public function supportsNormalization($data, string $format = null, array $context = []): bool
201+
{
202+
return $data instanceof Topic;
203+
}
204+
205+
public function hasCacheableSupportsMethod(): bool
206+
{
207+
return true;
208+
}
209+
210+
// ...
211+
}
212+
```
213+
214+
*After*
215+
```php
216+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
217+
218+
class TopicNormalizer implements NormalizerInterface
219+
{
220+
public function supportsNormalization($data, string $format = null, array $context = []): bool
221+
{
222+
return $data instanceof Topic;
223+
}
224+
225+
public function getSupportedTypes(?string $format): array
226+
{
227+
return [
228+
Topic::class => true,
229+
];
230+
}
231+
232+
// ...
233+
}
234+
```
142235
* First argument of `AttributeMetadata::setSerializedName()` is now required
143236
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
144237

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy