We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
in Event/FilterLocaleSwitchEvent.php, line 39
With booleans, only strict comparison (with === operator) should be used to lower bug risks and to improve performances.
===
* * @throws \InvalidArgumentException */ public function __construct(Request $request, $locale) { if (!is_string($locale) || null == $locale || '' == $locale) { throw new \InvalidArgumentException(sprintf('Wrong type, expected \'string\' got \'%s\'', $locale)); } $this->request = $request; $this->locale = $locale;
Posted from SensioLabsInsight
The text was updated successfully, but these errors were encountered:
I think we should only use if(!is_string($locale)) {. Edit: Or if(!is_string($locale) || !empty($locale)) { if empty strings should be forbidden.
if(!is_string($locale)) {
if(!is_string($locale) || !empty($locale)) {
is_string(false) = bool(false) is_string(true) = bool(false) is_string(NULL) = bool(false) is_string('abc') = bool(true) is_string('23') = bool(true) is_string(23) = bool(false) is_string('23.5') = bool(true) is_string(23.5) = bool(false) is_string('') = bool(true) is_string(' ') = bool(true) is_string('0') = bool(true) is_string(0) = bool(false)
http://php.net/manual/de/function.is-string.php
Sorry, something went wrong.
As explained here: #161 (comment) we should do if(!is_string($locale) || '' === $locale) {.
if(!is_string($locale) || '' === $locale) {
Successfully merging a pull request may close this issue.
in Event/FilterLocaleSwitchEvent.php, line 39
Posted from SensioLabsInsight
The text was updated successfully, but these errors were encountered: