8000 [CS] [Proposal] Replace calls to `0 === count(array())` with `!array()` · Issue #19182 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[CS] [Proposal] Replace calls to 0 === count(array()) with !array() #19182
Closed
@phansys

Description

@phansys

Since empty arrays always evaluates to false, these checks can be simplified.
An example from Symfony\Component\Routing\Annotation\Route::setRequirements():

// current check
if (0 === count($this->methods)) {
    // ...
}

// proposed check
if (!$this->methods) {
    // ...
}

NOTE: I've found 54 exact matches for 0 === count( at 2.7 branch.

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

      0