sebastianthiel/DI

View on GitHub

Showing 5 of 5 total issues

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

    public function reflectCallable($callable) : \ReflectionFunctionAbstract
    {
        if ($callable instanceof \ReflectionFunctionAbstract) {
            return $callable;
        } elseif (is_string($callable)) {
Severity: Minor
Found in src/DI/Resolver/Resolver.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 set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function set(string $classId, $value, ?ResolverInterface $Resolver = null) : void
    {
        if (!$this->validateClassId($classId)) {
            throw new InvalidArgumentException(sprintf('$classId has to be a valid class or interface name! "%s" given', $classId));
        }
Severity: Minor
Found in src/DI/Definition/Definition.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

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

    public function get($classId, array $arguments = [])
    {
        if (isset($this->processing[$classId])) {
            throw new CircularException(sprintf("Circular dependency detected. Stacktrace:\n%s", implode("\n", $this->processing)));
        }
Severity: Minor
Found in src/DI/DI.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

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

    public function resolveParameters(array $parameters, array $defaults = []) : array
    {
        $arguments = [];

        foreach ($parameters as $index => $parameter) {
Severity: Minor
Found in src/DI/Resolver/Resolver.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

Avoid too many return statements within this method.
Open

                return new \ReflectionMethod($callable[0], $callable[1]);
Severity: Major
Found in src/DI/Resolver/Resolver.php - About 30 mins to fix
    Severity
    Category
    Status
    Source
    Language