divineniiquaye/rade-di

View on GitHub

Showing 100 of 100 total issues

Function resolve has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve(Resolver $resolver, bool $createMethod = false): mixed
    {
        if (($this->options['abstract'] ?? false)) {
            throw new ContainerResolutionException(\sprintf('Resolving an abstract definition %s is not allowed.', $this->id));
        }
Severity: Minor
Found in src/Traits/DefinitionAwareTrait.php - About 1 day 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 build has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    protected function build(Resolver $resolver, p\BuilderFactory $builder, bool $createMethod): p\Node\Expr|p\Node\Stmt\ClassMethod
    {
        $defNode = $builder->method($resolver::createMethod($this->id))->makeProtected();
        $defTyped = $defNodes = [];

Severity: Minor
Found in src/Traits/DefinitionAwareTrait.php - About 1 day 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

File Resolver.php has 495 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

/*
Severity: Minor
Found in src/Resolver.php - About 7 hrs to fix

    Function autowireArgument has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        public function autowireArgument(\ReflectionParameter $parameter, array $types, array $providedParameters): mixed
        {
            foreach ($types as $typeName) {
                if (\PHP_MAJOR_VERSION >= 8 && $attributes = $parameter->getAttributes()) {
                    foreach ($attributes as $attribute) {
    Severity: Minor
    Found in src/Resolver.php - About 7 hrs 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 resolve has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolve($callback, array $args = []): mixed
        {
            if (\is_object($callback) && isset($this->cache[$callback])) {
                return $this->cache[$callback];
            }
    Severity: Minor
    Found in src/Resolver.php - About 6 hrs 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 findClasses has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        private function findClasses(string $namespace, string $pattern, array $excludePatterns): array
        {
            $classNames = [];
            $container = $this->container;
    
    
    Severity: Minor
    Found in src/DefinitionBuilder.php - About 6 hrs 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 autowireService has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function autowireService(mixed $definition, bool $allTypes = false, Container $container = null): array
        {
            $types = $autowired = [];
    
            if (\is_callable($definition)) {
    Severity: Minor
    Found in src/Resolver.php - About 5 hrs 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

    Definition has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Definition
    {
        use Traits\DefinitionAwareTrait;
    
        public function __construct(mixed $entity, private array $arguments = [])
    Severity: Minor
    Found in src/Definition.php - About 5 hrs to fix

      Function resolveStmt has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          private function resolveStmt(array $expressions, string $parentId, bool $leaveNodes = false): void
          {
              foreach ($expressions as &$expression) {
                  if ($expression instanceof Expression || $expression instanceof Return_) {
                      $expression = $expression->expr;
      Severity: Minor
      Found in src/NodeVisitor/AutowiringResolver.php - About 4 hrs 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 getResolved has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getResolved(Resolver $resolver, object $service, \ReflectionClass $reflection): object
          {
              $properties = [];
      
              foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
      Severity: Minor
      Found in src/Injector/Injectable.php - About 4 hrs 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 resolveProxies has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function resolveProxies(ContainerBuilder $container, BuilderFactory $builder, array $proxiedServices): array
          {
              $builtProxies = [];
      
              foreach ($proxiedServices as $method => $proxy) {
      Severity: Minor
      Found in src/Facade/FacadeProxy.php - About 4 hrs 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 bootExtensions has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          private function bootExtensions(array $extensions, \SplStack &$afterLoading, string $extraKey = null): void
          {
              $container = $this->container;
      
              foreach ($extensions as $resolved) {
      Severity: Minor
      Found in src/Extensions/ExtensionBuilder.php - About 4 hrs 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 build has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function build(Resolver $resolver, p\BuilderFactory $builder, bool $createMethod): p\Node\Expr|p\Node\Stmt\ClassMethod
          {
              $defNode = $builder->method($resolver::createMethod($this->id))->makeProtected();
              $defTyped = $defNodes = [];
      
      
      Severity: Major
      Found in src/Traits/DefinitionAwareTrait.php - About 4 hrs to fix

        File DefinitionBuilder.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        /*
        Severity: Minor
        Found in src/DefinitionBuilder.php - About 3 hrs to fix

          Function findResourcePath has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              private function findResourcePath(string $namespace): string
              {
                  foreach (\spl_autoload_functions() as $classLoader) {
                      if (!\is_array($classLoader)) {
                          continue;
          Severity: Minor
          Found in src/DefinitionBuilder.php - About 3 hrs 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 resolve has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function resolve($callback, array $args = []): mixed
              {
                  if (\is_object($callback) && isset($this->cache[$callback])) {
                      return $this->cache[$callback];
                  }
          Severity: Major
          Found in src/Resolver.php - About 3 hrs to fix

            Function resolveReference has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function resolveReference(string $reference): mixed
                {
                    $invalidBehavior = $this->container::EXCEPTION_ON_MULTIPLE_SERVICE;
            
                    if ('?' === $reference[0]) {
            Severity: Minor
            Found in src/Resolver.php - About 2 hrs 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

            File Definition.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            /*
            Severity: Minor
            Found in src/Definition.php - About 2 hrs to fix

              DefinitionBuilder has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class DefinitionBuilder implements ResetInterface
              {
                  private ?string $definition = null, $directory = null;
                  private bool $trackDefaults = false, $condition = true;
              
              
              Severity: Minor
              Found in src/DefinitionBuilder.php - About 2 hrs to fix

                Function resolveCallable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function resolveCallable(callable|array $callback, array $arguments = []): mixed
                    {
                        if (\is_array($callback)) {
                            if ((2 === \count($callback) && \array_is_list($callback)) && \is_string($callback[1])) {
                                $callback[0] = $this->resolve($callback[0]);
                Severity: Minor
                Found in src/Resolver.php - About 2 hrs 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