Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug symfony#36913 [FrameworkBundle] fix type annotation on Controller…
…Trait::addFlash() (ThomasLandauer) This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] fix type annotation on ControllerTrait::addFlash() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix symfony#28991 Fix symfony#34645 | License | MIT | Doc PR | not yet, see below Removing `string` type-hint of $message at addFlash() Closes symfony#28991 and symfony#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. * symfony#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. * This isn't a real new feature, but it isn't a bugfix either ;-) * I didn't update `src/**/CHANGELOG.md` yet. * I'm not sure if it's necessary to update the docs. Maybe a short note https://symfony.com/doc/current/controller.html#flash-messages ? Commits ------- dfb4614 Update AbstractController.php
- Loading branch information