soliantconsulting/SimpleFM

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

Summary

Maintainability
A
1 hr
Test Coverage
A
100%

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

        string $layout,
        string $className,
        array $fields,
        array $embeddables,
        array $oneToMany,
Severity: Major
Found in src/Repository/Builder/Metadata/Entity.php - About 1 hr to fix

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

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

    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 'validateArray'.
    Open

            Assertion::count(array_filter($array, function ($metadata) use ($expectedClassName) : bool {
                return !$metadata instanceof $expectedClassName;
            }), 0, sprintf('At least one element in array is not an instance of %s', $expectedClassName));

    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 'getInterfaceName'.
    Open

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

    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