wpzapp/config

View on GitHub
src/Path/PathWalker.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using WPZAPP\Config\Path\count() function in while loops.
Open

        while (count($segments) > 0) {
            $key = array_shift($segments);

            if (!isset($result[$key])) {
                return false;
Severity: Minor
Found in src/Path/PathWalker.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

Avoid using WPZAPP\Config\Path\count() function in while loops.
Open

        while (count($segments) > 0) {
            $key = array_shift($segments);

            if (!isset($result[$key])) {
                throw new PathSegmentNotFoundException(sprintf('Segment %1$s of path %2$s does not exist on the input array.', $key, (string) $path));
Severity: Minor
Found in src/Path/PathWalker.php by phpmd

CountInLoopExpression

Since: 2.7.0

Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

Example

class Foo {

  public function bar()
  {
    $array = array();

    for ($i = 0; count($array); $i++) {
      // ...
    }
  }
}

Source https://phpmd.org/rules/design.html#countinloopexpression

There are no issues that match your filters.

Category
Status