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

Flash Messages are now lists of strings #34

Open
wants to merge 2 commits into
base: 1.9.x
Choose a base branch
from

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Jan 18, 2024

Q A
Documentation not-yet
Bugfix no
BC Break yes
New Feature yes
RFC yes
QA yes

This patch breaks BC so it'll need to go into 2.x if acceptable.

The main user-facing change is that flash messages are now list<non-empty-string> instead of mixed.

Previously:

$flash->flash('info', 'whatever');
$flash->flash('info', 'other stuff');
// Next Hop
echo $flash->getFlash('info'); // "other stuff"

Now:

$flash->flash('info', 'whatever');
$flash->flash('info', 'other stuff');
// Next Hop
var_dump($flash->getFlash('info')); // ["whatever", "other stuff"]

Tests have been simplified by replacing mocks with concrete instances. Considering that this library only works with Mezzio\Session, there's little point mocking Session and any BC breaks in Session will be discovered here during lock file maintenance.

Docs will need updating which I'll do in separate patch if this one is acceptable

Repeated calls to `$flasher->flash('error', 'some message')` will aggregate messages under an `error` namespace. Consequently, `$flasher->getFlash('error')` will now yield `list<string>`.

Messages themselves are restricted to `string` instead of `mixed` contributing to 100% type-coverage.

Tests have been simplified by replacing mocks with concrete instances. Considering that this library only works with Mezzio\Session, there's little point mocking Session and any BC breaks in Session will be discovered here during lock file maintenance.

Signed-off-by: George Steel <george@net-glue.co.uk>
@gsteel gsteel added BC Break Enhancement New feature or request labels Jan 18, 2024
@gsteel gsteel added this to the 2.0.0 milestone Jan 18, 2024
Signed-off-by: George Steel <george@net-glue.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant