Skip to content

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

@lunetics

Description

@lunetics

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions