Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] fix type annotation on ControllerTrait::addFlash() #36913

Merged
merged 1 commit into from Jun 10, 2020
Merged

[FrameworkBundle] fix type annotation on ControllerTrait::addFlash() #36913

merged 1 commit into from Jun 10, 2020

Commits on Jun 4, 2020

  1. 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.
    ThomasLandauer authored and nicolas-grekas committed Jun 4, 2020
    Copy the full SHA
    dfb4614 View commit details
    Browse the repository at this point in the history