Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:3.4fromThomasLandauer:patch-1
Jun 10, 2020
Merged

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

fabpot merged 1 commit intosymfony:3.4fromThomasLandauer:patch-1
Jun 10, 2020

Conversation

@ThomasLandauer
Copy link
Contributor

@ThomasLandauerThomasLandauer commentedMay 22, 2020
edited by nicolas-grekas
Loading

QA
Branch?3.4
Bug fix?no
New feature?no
Deprecations?no
TicketsFix#28991Fix#34645
LicenseMIT
Doc PRnot yet, see below

Removingstring type-hint of $message at addFlash()

Closes#28991 and#34645

Reasons:

@nicolas-grekas
Copy link
Member

This should be considered on 3.4 first to me, agreeing on changing the annotation.

Note that technically this is a BC break, but the method is@final in 4.4.
That's something to consider when deciding what to do here.

@ThomasLandauer
Copy link
ContributorAuthor

ThomasLandauer commentedMay 23, 2020
edited
Loading

In 3.4 the type-hint isn't there - so everything's fine:https://github.com/symfony/symfony/blob/3.4/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php#L196

In 4.4 it is there, but the entire method still lives inSymfony\Bundle\FrameworkBundle\Controller\ControllerTrait (which doesn't exist any more):https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php#L159
So should I do the change there too?

@ro0NL
Copy link
Contributor

@param string $message should be removed in 3.4 isnt it, which lead to this issue in the first place i believe.

Removing `string` type-hint of $message at addFlash()Closes#28991 and#34645Reasons:* `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`, seehttps://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.
@nicolas-grekasnicolas-grekas changed the base branch frommaster to3.4June 4, 2020 10:40
@nicolas-grekasnicolas-grekas changed the titleUpdate AbstractController.php[FrameworkBundle] fix type annotation on ControllerTrait::addFlash()Jun 4, 2020
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(I rebased to target 3.4, the change on upper branches will be applied when merging up)

@fabpot
Copy link
Member

Thank you@ThomasLandauer.

@fabpotfabpot merged commitf87c993 intosymfony:3.4Jun 10, 2020
This was referencedJun 12, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

FRAMEWORK method addFlash definition in AbstractController differs from underlying FlashBag->add Flash message behavior changed

5 participants

@ThomasLandauer@nicolas-grekas@ro0NL@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp