tddwizard/magento2-fixtures

View on GitHub

Showing 57 of 61 total issues

Avoid unused private fields such as '$paymentMethod'.
Open

    private $paymentMethod;
Severity: Minor
Found in src/Sales/OrderBuilder.php by phpmd

UnusedPrivateField

Since: 0.2

Detects when a private field is declared and/or assigned a value, but not used.

Example

class Something
{
    private static $FOO = 2; // Unused
    private $i = 5; // Unused
    private $j = 6;
    public function addOne()
    {
        return $this->j++;
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->customerFixtures[$key] = new CustomerFixture($customer);
        }
Severity: Minor
Found in src/Customer/CustomerFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->invoiceFixtures[$key] = new InvoiceFixture($invoice);
        }
Severity: Minor
Found in src/Sales/InvoiceFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid unused private fields such as '$cartBuilder'.
Open

    private $cartBuilder;
Severity: Minor
Found in src/Sales/OrderBuilder.php by phpmd

UnusedPrivateField

Since: 0.2

Detects when a private field is declared and/or assigned a value, but not used.

Example

class Something
{
    private static $FOO = 2; // Unused
    private $i = 5; // Unused
    private $j = 6;
    public function addOne()
    {
        return $this->j++;
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->categoryFixtures[$key] = new CategoryFixture($category);
        }
Severity: Minor
Found in src/Catalog/CategoryFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method withCustomAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $builder->product->setCustomAttribute($code, $value);
            }
Severity: Minor
Found in src/Catalog/ProductBuilder.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid unused private fields such as '$customerBuilder'.
Open

    private $customerBuilder;
Severity: Minor
Found in src/Sales/OrderBuilder.php by phpmd

UnusedPrivateField

Since: 0.2

Detects when a private field is declared and/or assigned a value, but not used.

Example

class Something
{
    private static $FOO = 2; // Unused
    private $i = 5; // Unused
    private $j = 6;
    public function addOne()
    {
        return $this->j++;
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->orderFixtures[$key] = new OrderFixture($order);
        }
Severity: Minor
Found in src/Sales/OrderFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method withVisibility uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $builder->product->setVisibility($visibility);
        }
Severity: Minor
Found in src/Catalog/ProductBuilder.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method withStatus uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $builder->product->setStatus($status);
        }
Severity: Minor
Found in src/Catalog/ProductBuilder.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->shipmentFixtures[$key] = new ShipmentFixture($shipment);
        }
Severity: Minor
Found in src/Sales/ShipmentFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method add uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->creditmemoFixtures[$key] = new CreditmemoFixture($creditmemo);
        }
Severity: Minor
Found in src/Sales/CreditmemoFixturePool.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid unused private fields such as '$productBuilders'.
Open

    private $productBuilders;
Severity: Minor
Found in src/Sales/OrderBuilder.php by phpmd

UnusedPrivateField

Since: 0.2

Detects when a private field is declared and/or assigned a value, but not used.

Example

class Something
{
    private static $FOO = 2; // Unused
    private $i = 5; // Unused
    private $j = 6;
    public function addOne()
    {
        return $this->j++;
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

Possibly zero references to use statement for classlike/namespace Category (\Magento\Catalog\Model\Category)
Open

use Magento\Catalog\Model\Category;
Severity: Minor
Found in src/Catalog/CategoryFixture.php by phan

Possibly zero references to use statement for classlike/namespace Product (\Magento\Catalog\Model\Product)
Open

use Magento\Catalog\Model\Product;
Severity: Minor
Found in src/Checkout/CartBuilder.php by phan

Possibly zero references to use statement for classlike/namespace Quote (\Magento\Quote\Model\Quote)
Open

use Magento\Quote\Model\Quote;
Severity: Minor
Found in src/Checkout/CustomerCheckout.php by phan

Returning type \Magento\Catalog\Model\Product but buildWithoutSave() is declared to return \Magento\Catalog\Api\Data\ProductInterface
Confirmed

        return clone $this->product;
Severity: Minor
Found in src/Catalog/ProductBuilder.php by phan
Severity
Category
Status
Source
Language