acelot/resolver

View on GitHub

Showing 8 of 8 total issues

Method resolve has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function resolve(ResolverInterface $resolver)
    {
        $type = self::getCallableType($this->callable);

        switch ($type) {
Severity: Minor
Found in src/Definition/FactoryDefinition.php - About 1 hr to fix

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

        protected function resolveParameters($parameters, ResolverInterface $resolver): \Iterator
        {
            foreach ($parameters as $param) {
                if ($this->hasArgument($param->getName())) {
                    yield $this->getArgument($param->getName());
    Severity: Minor
    Found in src/Definition/Traits/ArgumentsTrait.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 getCallableType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function getCallableType(callable $callable): int
        {
            // Closure
            if ($callable instanceof \Closure) {
                return self::TYPE_CLOSURE;
    Severity: Minor
    Found in src/Definition/FactoryDefinition.php - About 45 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 self::TYPE_STRING_SEPARATED;
    Severity: Major
    Found in src/Definition/FactoryDefinition.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $ref->invoke($resolver->resolve($fqcn), ...$args);
      Severity: Major
      Found in src/Definition/FactoryDefinition.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return call_user_func($this->callable, ...$args);
        Severity: Major
        Found in src/Definition/FactoryDefinition.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return self::TYPE_UNKNOWN;
          Severity: Major
          Found in src/Definition/FactoryDefinition.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return self::TYPE_STRING;
            Severity: Major
            Found in src/Definition/FactoryDefinition.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language