daikon-cqrs/interop

View on GitHub

Showing 5 of 5 total issues

Function construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private static function construct(array $payload): array
    {
        $valueFactories = static::inferValueFactories();
        $constructor = (new ReflectionClass(static::class))->getConstructor();
        if (is_null($constructor) || $constructor->getNumberOfParameters() === 0) {
Severity: Minor
Found in src/FromToNativeTrait.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function toNative has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function toNative(): array
    {
        $state = [];
        $reflectionClass = new ReflectionClass($this);
        foreach (static::getInheritance() as $currentClass) {
Severity: Minor
Found in src/FromToNativeTrait.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getClassAnnotations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getClassAnnotations(string ...$keys): array
    {
        $annotations = $matches = [];
        foreach (static::getInheritance() as $class) {
            if (!($docComment = $class->getDocComment())
Severity: Minor
Found in src/SupportsAnnotations.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        string $message = '',
        int $code = 0,
        string $propertyPath = null,
        $value = null,
        array $constraints = []
Severity: Minor
Found in src/InvalidArgumentException.php - About 35 mins to fix

    Function inferTypeFactories has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function inferTypeFactories(): array
        {
            $typeFactories = [];
            foreach (static::getClassAnnotations('type') as $annotation) {
                $callable = explode('::', $annotation['value']);
    Severity: Minor
    Found in src/SupportsAnnotations.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language