Skip to content

Commit 3aca99d

Browse files
Merge branch '4.4'
* 4.4: cs fix Fix return statements [TwigBridge] add missing dep Add type declarations to private DefaultChoiceListFactory methods Add false type to ChoiceListFactoryInterface::createView $label argument Update UPGRADE guide of 4.3 for EventDispatcher [SecurityBundle] display the correct class name on the deprecated notice
2 parents 2a6cd15 + 046aff2 commit 3aca99d

File tree

44 files changed

+121
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+121
-91
lines changed

UPGRADE-4.3.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,36 @@ Dotenv
5454
EventDispatcher
5555
---------------
5656

57-
* The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated
57+
* 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
58+
59+
You have to swap arguments when calling `dispatch()`:
60+
61+
Before:
62+
```php
63+
$this->eventDispatcher->dispatch(Events::My_EVENT, $event);
64+
```
65+
66+
After:
67+
```php
68+
$this->eventDispatcher->dispatch($event, Events::My_EVENT);
69+
```
70+
71+
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:
72+
73+
Before:
74+
```php
75+
public function __construct(EventDispatcherInterface $eventDispatcher) {
76+
$this->eventDispatcher = $eventDispatcher;
77+
}
78+
```
79+
80+
After:
81+
```php
82+
public function __construct(EventDispatcherInterface $eventDispatcher) {
83+
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
84+
}
85+
```
86+
5887
* The `Event` class has been deprecated, use `Symfony\Contracts\EventDispatcher\Event` instead
5988

6089
Filesystem

src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function isIntId(): bool
8989
public function getIdValue(object $object = null)
9090
{
9191
if (!$object) {
92-
return;
92+
return null;
9393
}
9494

9595
if (!$this->om->contains($object)) {

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function guessRequired(string $class, string $property)
9999
$classMetadatas = $this->getMetadata($class);
100100

101101
if (!$classMetadatas) {
102-
return;
102+
return null;
103103
}
104104

105105
/** @var ClassMetadataInfo $classMetadata */

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getToken()
6868
/**
6969
* Returns the current user.
7070
*
71-
* @return mixed
71+
* @return object|null
7272
*
7373
* @see TokenInterface::getUser()
7474
*/
@@ -79,7 +79,7 @@ public function getUser()
7979
}
8080

8181
if (!$token = $tokenStorage->getToken()) {
82-
return;
82+
return null;
8383
}
8484

8585
$user = $token->getUser();

src/Symfony/Component/Config/Util/XmlUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public static function phpize($value)
219219

220220
switch (true) {
221221
case 'null' === $lowercaseValue:
222-
return;
222+
return null;
223223
case ctype_digit($value):
224224
$raw = $value;
225225
$cast = (int) $value;

src/Symfony/Component/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public function add(Command $command)
465465
if (!$command->isEnabled()) {
466466
$command->setApplication(null);
467467

468-
return;
468+
return null;
469469
}
470470

471471
if (null === $command->getDefinition()) {

src/Symfony/Component/CssSelector/Parser/TokenStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function getNextIdentifierOrStar()
155155
}
156156

157157
if ($next->isDelimiter(['*'])) {
158-
return;
158+
return null;
159159
}
160160

161161
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next);

src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa
2929
$type = $r->getReturnType();
3030
}
3131
if (!$type) {
32-
return;
32+
return null;
3333
}
3434
if (!\is_string($type)) {
3535
$name = $type->getName();
@@ -45,7 +45,7 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa
4545
return $prefix.$name;
4646
}
4747
if (!$r instanceof \ReflectionMethod) {
48-
return;
48+
return null;
4949
}
5050
if ('self' === $lcName) {
5151
return $prefix.$r->getDeclaringClass()->name;

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ private function linkException(string $origin, string $target, string $linkType)
387387
public function readlink(string $path, bool $canonicalize = false)
388388
{
389389
if (!$canonicalize && !is_link($path)) {
390-
return;
390+
return null;
391391
}
392392

393393
if ($canonicalize) {
394394
if (!$this->exists($path)) {
395-
return;
395+
return null;
396396
}
397397

398398
if ('\\' === \DIRECTORY_SEPARATOR) {

src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,11 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
7878
* attributes that should be added to the respective choice.
7979
*
8080
* @param array|callable|null $preferredChoices The preferred choices
81-
* @param callable|null $label The callable generating the
82-
* choice labels
83-
* @param callable|null $index The callable generating the
84-
* view indices
85-
* @param callable|null $groupBy The callable generating the
86-
* group names
87-
* @param array|callable|null $attr The callable generating the
88-
* HTML attributes
81+
* @param callable|false|null $label The callable generating the choice labels;
82+
* pass false to discard the label
83+
* @param callable|null $index The callable generating the view indices
84+
* @param callable|null $groupBy The callable generating the group names
85+
* @param array|callable|null $attr The callable generating the HTML attributes
8986
*
9087
* @return ChoiceListView The choice list view
9188
*/

0 commit comments

Comments
 (0)