divineniiquaye/rade-di

View on GitHub

Showing 100 of 100 total issues

Method autowireArgument has 57 lines of code (exceeds 25 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: Major
Found in src/Resolver.php - About 2 hrs to fix

    Function doCreate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function doCreate(object $definition): void
        {
            $this->trackDefaults = false;
    
            foreach ($this->defaults as $offset => $defaultMethods) {
    Severity: Minor
    Found in src/DefinitionBuilder.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

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

        public function resolve(Container $container): array
        {
            $i = 0;
            $services = $refs = [];
    
    
    Severity: Minor
    Found in src/Definitions/TaggedLocator.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

    Function autowireArguments has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function autowireArguments(\ReflectionFunctionAbstract $function, array $args = []): array
        {
            $resolvedParameters = [];
            $nullValuesFound = 0;
            $args = $this->resolveArguments($args); // Resolves provided arguments.
    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

    Method resolve has 54 lines of code (exceeds 25 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: Major
    Found in src/Traits/DefinitionAwareTrait.php - About 2 hrs to fix

      Function resolveClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function resolveClass(string $class, array $args = []): object
          {
              if (\is_subclass_of($class, ServiceProviderInterface::class)) {
                  $services = [];
      
      
      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

      Function doLoad has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function doLoad(string $id, int $invalidBehavior): mixed
          {
              if (null == ($definition = $this->definitions[$id] ?? null)) {
                  if (\array_key_exists($id, $this->types)) {
                      return $this->autowired($id, 1 === ($invalidBehavior & self::EXCEPTION_ON_MULTIPLE_SERVICE));
      Severity: Minor
      Found in src/Container.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

      Function removeDefinition has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function removeDefinition(string $id): void
          {
              unset($this->definitions[$id], $this->services[$id]);
      
              foreach ($this->aliases as $alias => $aliased) {
      Severity: Minor
      Found in src/Traits/DefinitionTrait.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

      Function boot has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function boot(Container $container): void
          {
              if (!$container instanceof ContainerBuilder) {
                  foreach ($this->config as $name => $value) {
                      if (null === $value) {
      Severity: Minor
      Found in src/Extensions/PhpExtension.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 afterTraverse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function afterTraverse(array $nodes)
          {
              foreach ($nodes as $node) {
                  if ($node instanceof Class_) {
                      foreach ($node->stmts as $methodNode) {
      Severity: Minor
      Found in src/NodeVisitor/AutowiringResolver.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 doAnalyse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function doAnalyse(array $definitions, bool $onlyDefinitions = false): array
          {
              $methodsMap = $serviceMethods = $wiredTypes = [];
      
              if (!isset($methodsMap[self::SERVICE_CONTAINER])) {
      Severity: Minor
      Found in src/ContainerBuilder.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 compile has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function compile(array $options = [])
          {
              $options += ['strictType' => true, 'printToString' => true, 'containerClass' => 'CompiledContainer'];
              $astNodes = $options['strictType'] ? [new Declare_([new DeclareDeclare('strict_types', $this->resolver->getBuilder()->val(1))])] : [];
              $processedData = $this->doAnalyse($this->definitions);
      Severity: Minor
      Found in src/ContainerBuilder.php - About 1 hr to fix

        Method getResolved has 44 lines of code (exceeds 25 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 1 hr to fix

          Method autowireService has 44 lines of code (exceeds 25 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 1 hr to fix

            Function sortExtensions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private function sortExtensions(array $extensions): array
                {
                    if (0 === \count($extensions)) {
                        return [];
                    }
            Severity: Minor
            Found in src/Extensions/ExtensionBuilder.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 setContainer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function setContainer(Container $container, string $id, bool $anonymous = false)
                {
                    $this->container = $container;
                    $this->id = $id;
            
            
            Severity: Minor
            Found in src/Traits/DefinitionAwareTrait.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 resolveArguments has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function resolveArguments(array $arguments = []): array
                {
                    foreach ($arguments as $key => $value) {
                        if (\is_array($value)) {
                            $resolved = $this->resolveArguments($value);
            Severity: Minor
            Found in src/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

            Method findClasses has 43 lines of code (exceeds 25 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 1 hr to fix

              Method doAnalyse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function doAnalyse(array $definitions, bool $onlyDefinitions = false): array
                  {
                      $methodsMap = $serviceMethods = $wiredTypes = [];
              
                      if (!isset($methodsMap[self::SERVICE_CONTAINER])) {
              Severity: Minor
              Found in src/ContainerBuilder.php - About 1 hr to fix

                Function afterTraverse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function afterTraverse(array $nodes)
                    {
                        $node = $nodes[1] ?? $nodes[0];
                
                        if (isset($nodes[0]) && $nodes[0] instanceof Declare_) {
                Severity: Minor
                Found in src/NodeVisitor/DefinitionsSplitter.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

                Severity
                Category
                Status
                Source
                Language