LocaleBundle icon indicating copy to clipboard operation
LocaleBundle copied to clipboard

[Insight] Logical operators should be avoided - in LocaleGuesser/BrowserLocaleGuesser.php, line 52

Open lunetics opened this issue 10 years ago • 0 comments

in LocaleGuesser/BrowserLocaleGuesser.php, line 52

The or operator does not have the same precedence as ||. This could lead to unexpected behavior, use || instead.

        $validator = $this->metaValidator;
        // Get the preferred locale from the Browser.
        $preferredLocale = $request->getPreferredLanguage();
        $availableLocales = $request->getLanguages();

        if (!$preferredLocale OR count($availableLocales) === 0) {
            return false;
        }

        // If the preferred primary locale is allowed, return the locale.
        if ($validator->isAllowed($preferredLocale)) {

Posted from SensioLabsInsight

lunetics avatar May 09 '15 14:05 lunetics