ama-team/php-projection-framework

View on GitHub

Showing 102 of 102 total issues

Avoid using static access to class '\AmaTeam\Image\Projection\Conversion\Processor\FXAA\EdgeDirectionCalculator' in method 'process'.
Open

                EdgeDirectionCalculator::apply($edge);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using AmaTeam\Image\Projection\Filesystem\sizeof() function in while loops.
Open

        while (sizeof($candidates) > 0) {
            /** @var Chunk $chunk */
            $chunk = array_shift($candidates);
            if ($chunk->getType() !== Chunk::TYPE_EXACT_MATCH) {
                break;
Severity: Minor
Found in src/Filesystem/Pattern.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

Severity
Category
Status
Source
Language