Skip to content

[Insight] Boolean should be compared strictly - in Event/FilterLocaleSwitchEvent.php, line 39 #157

@lunetics

Description

@lunetics

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions