soliantconsulting/SimpleFM

View on GitHub
src/Repository/Builder/Metadata/OneToOne.php

Summary

Maintainability
A
1 hr
Test Coverage
A
100%

Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $propertyName,
        string $targetTable,
        string $targetEntity,
        string $targetFieldName,
        string $targetInterfaceName = null,
Severity: Major
Found in src/Repository/Builder/Metadata/OneToOne.php - About 1 hr to fix

    The method __construct has 10 parameters. Consider reducing the number of parameters to less than 10.
    Open

        public function __construct(
            string $propertyName,
            string $targetTable,
            string $targetEntity,
            string $targetFieldName,

    The method __construct has a boolean flag argument $eagerHydration, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $eagerHydration = false

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    The method __construct has a boolean flag argument $owningSide, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $owningSide = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    The method __construct has a boolean flag argument $readOnly, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $readOnly = false,

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Avoid using static access to class '\Assert\Assertion' in method '__construct'.
    Open

                Assertion::notNull($fieldName);

    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 static access to class '\Assert\Assertion' in method 'getTargetPropertyName'.
    Open

            Assertion::notNull($this->targetPropertyName);

    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 static access to class '\Assert\Assertion' in method 'getFieldName'.
    Open

            Assertion::notNull($this->fieldName);

    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 static access to class '\Assert\Assertion' in method 'getTargetInterfaceName'.
    Open

            Assertion::notNull(
                $this->targetInterfaceName,
                sprintf('Target entity %s has no interface name defined', $this->targetEntity)
            );

    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 static access to class '\Assert\Assertion' in method '__construct'.
    Open

                Assertion::notNull($targetPropertyName);

    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

    There are no issues that match your filters.

    Category
    Status