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

Change what type of types can be assigned #12

Merged

Conversation

NigelGreenway
Copy link
Contributor

Allows an object, string or an array to be assigned to
the storage array.

refs: #7

Nigel Greenway added 2 commits December 15, 2015 23:42
Allows an object, string or an array to be assigned to
the storage array.

refs: slimphp#7
if (
is_array($message) === true
|| is_object($message) === true
) {
Copy link
Member

Choose a reason for hiding this comment

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

I honestly would get rid of the checks and just have it append to the array without the (string)

//ping @silentworks @akrabat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@geggleto Sorry, I was meant to have added a comment about this with the PR.

This was a discussion point more than anything as my thoughts behind this was that pushing an array or object onto the slimFlash stack with the given key would result in the following:

array(
    'slimFlash' => array(
        'key' => array(
            0 => array(
                'data' => array(
                    // ...
                )
            )
        )
    )
)

This could become annoying trying to access the data stack.

Am I over thinking the problem or is it just creating an issue/hindrance?

Copy link
Member

Choose a reason for hiding this comment

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

@NigelGreenway yeah I think I would leave that down to the developer to decide. I now understand why we were only storing string as the session store might not know how to deal with objects, but I also think if a developer decides to throw an object into the session, they should know what their store can handle or deal with how it should handle what they throw at it.

My expectation was to see this:

$this->storage[$this->storageKey][$key][] = (string)$message;

become:

$this->storage[$this->storageKey][$key][] = $message;

Here I would be making no assumption as to what the developer want to store, $message could be a string, object or array if they wanted. We might however need to note this in the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@silentworks, @geggleto; I will change that now.

Makes more sense leaving it down to the developer.

Nigel Greenway added 2 commits December 16, 2015 10:47
It was suggested by @silentworks that the only change to the
code base should be that `(string)` type casting should be
removed and allow the developer to handle how its handled.
@NigelGreenway
Copy link
Contributor Author

I have update the code base. @silentworks, would you have a look over the readme with my addition as I am not sure how to word it, unless what I have put is enough?

@silentworks
Copy link
Member

This looks great, lets get a second opinion on it before merging it in.

//cc @akrabat @geggleto @codeguy

@codeguy
Copy link
Member

codeguy commented Dec 17, 2015

Looks fine to me.

silentworks added a commit that referenced this pull request Dec 17, 2015
…ages

Change what type of types can be assigned
@silentworks silentworks merged commit 5599aef into slimphp:master Dec 17, 2015
@silentworks
Copy link
Member

Thanks for this @NigelGreenway

@NigelGreenway
Copy link
Contributor Author

np @silentworks :)

@geoffreyvanwyk
Copy link

@silentworks, when will this be published to Packagist? The latest date for slim/flash on Packagist is 2015-08-16 22:49 UTC.

@geekish
Copy link

geekish commented Nov 11, 2016

+1 for tagging a release!

@geggleto
Copy link
Member

I will poke some pepple for a release.

@akrabat akrabat added this to the 0.2.0 milestone Nov 11, 2016
@akrabat
Copy link
Member

akrabat commented Nov 11, 2016

Version 0.2.0 released to Packagist.

Sorry - didn't realise that this one wasn't in 0.1.0

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.

None yet

7 participants