Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfb4614

Browse files
ThomasLandauernicolas-grekas
authored andcommitted
Update AbstractController.php
Removing `string` type-hint of $message at addFlash() Closes #28991 and #34645 Reasons: * `addFlash()` is just a convenience shortcut for `FlashBagInterface::add()` which doesn't have the type hint: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php#L28 . So removing it here improves consistency. * #28991 (comment) is a valid use case for having an object as `$message`. * Twig doesn't have any rendering helpers for the `message`, see https://symfony.com/doc/current/controller.html#flash-messages . And since users have to take care of displaying the `message` themselves, there's no reason to force a string upon them.
1 parent 400ab7c commit dfb4614

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected function file($file, $fileName = null, $disposition = ResponseHeaderBa
187187
* Adds a flash message to the current session for type.
188188
*
189189
* @param string $type The type
190-
* @param string $message The message
190+
* @param mixed $message The message
191191
*
192192
* @throws \LogicException
193193
*

0 commit comments

Comments
 (0)