This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change. It's a public function and when used directly, you will get an undefined index notice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @xtreamwayz , why?
empty acts like ! isset() plus not-empty value. I am just using a stronger checking. I just intercept empty arrays (or whatever) as well...
before: if not set or not array return (does not return early for empty arrays, no need to loop over an empty array)
my-mod: if not set or empty (whatever) or not array return
I am just making the function skip the for loop in case of an empty array
kind regards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh... for some reason I thought it would through a notification but it doesn't. Ignore my comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xtreamwayz ,no problem :-)
I was also thinking about storing the resulting locale in a request attribute instead of using
Locale::setDefault()
in order to make it compatible with async-php setups. What do you reckon?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xtreamwayz , oh ...another thing I forgot... the
$config
var is casted to an array because theinject*
methods requires it, so I left it alone...but since I now check for key existence$config
should be anarray
or at least implementArrayAccess
. Usually if aconfig
service exists in a zend-expressive application, it is an array, so we could also remove those argument castings unless we want to support a non array ArrayAccess configuration object.kind regards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I do usually. So yes, go ahead.
EDIT: This is for the other PR right?
Config should always be an array or ArrayAccess object for Aura.Di.
Usually what we do is
$config = $container->get('config') ?? [];
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xtreamwayz 1. Oh gosh...yes..right....i have a "few" repos open in so many browser tabs and too little sleep... 2. Good, I am glad I didn't remove the array castings since we need to support ArrayAccess for Aura.Di. best regards.