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

Appearance settings

[HttpFoundation] update phpdoc of FlashBagInterface::add() #27765

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

Merged
merged 1 commit into from
Jun 29, 2018

Conversation

sir-kain
Copy link
Contributor

@sir-kain sir-kain commented Jun 28, 2018

Q A
Branch? 2.8
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

**Reason why I propose to change the docblock like this: **
The FlashBagInterface::add() function does not work only with the string type in second parameter

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

apart from an extra file, this change looks good to me: messages are put in the session, so that anything that can be serialized fits there. It actually works and I'm pretty sure many use it already to push objects to twig views.

.idea/vcs.xml Outdated
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

this file should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its done

@nicolas-grekas nicolas-grekas added this to the 2.8 milestone Jun 29, 2018
@nicolas-grekas nicolas-grekas changed the base branch from master to 2.8 June 29, 2018 05:41
@@ -24,7 +24,7 @@
* Adds a flash message for type.
*
* @param string $type
* @param string $message
* @param mixed $message
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC the rationale behind this type hint is that Symfony does not (did not?) want to take the responsability of serializing this properly. So technically, it works, but that might generate invalid support.

Copy link
Contributor

@greg0ire greg0ire Jun 29, 2018

Choose a reason for hiding this comment

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

If this still holds true, maybe you could add a comment right here, explaining just that.

Copy link
Member

Choose a reason for hiding this comment

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

not sure how this applies: you are already allowed to put any serializable in the session, do we have special comments about this?

Copy link
Contributor

@greg0ire greg0ire Jun 29, 2018

Choose a reason for hiding this comment

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

I can't find the source of this discussion I saw, but if we go this way, I'd suggest adding a message indicating that $message should be serializable, and what that means (it doesn't crash when given to \serialize()? is the symfony serializer supported? What about a custom serializer service?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, a docs PR should probably be done too.

Copy link
Contributor

Choose a reason for hiding this comment

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

FlashBagInterface::add should have exactly the same support as Session::set (it's basicaly a specialized Session::set).

Session::set doesn't say anything about what can be stored in the session (https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php#L121) so I gess it's the responsibility of the implementation to decide what can be stored (all the implementations in symfony are based on serialize but some libs could extend it to support something else).

Copy link
Contributor

Choose a reason for hiding this comment

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

Forget everything I said then, it would make no sense to add that comment here and not in the session interface.

@nicolas-grekas
Copy link
Member

Thank you @sir-kain.

@nicolas-grekas nicolas-grekas merged commit 9135e18 into symfony:2.8 Jun 29, 2018
nicolas-grekas added a commit that referenced this pull request Jun 29, 2018
…() (sir-kain)

This PR was squashed before being merged into the 2.8 branch (closes #27765).

Discussion
----------

[HttpFoundation] update phpdoc of FlashBagInterface::add()

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

**Reason why I propose to change the docblock like this: **
The `FlashBagInterface::add()` function does not work only with the `string` type in second parameter

Commits
-------

9135e18 [HttpFoundation] update phpdoc of FlashBagInterface::add()
@greg0ire
Copy link
Contributor

Congrats on your first PR!!!

@Aiden01
Copy link

Aiden01 commented Jun 29, 2018

Good Job ! @sir-kain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.