Showing 3,272 of 4,939 total issues

Method locateMiscellaneousTokenCompletion has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        CompletionRequest $request,
        CodeBase $code_base,
        Context $context,
        Node $node,
        string $incomplete_constant_name,
Severity: Minor
Found in src/Phan/LanguageServer/CompletionResolver.php - About 45 mins to fix

    Function resolveParentTemplateType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolveParentTemplateType(array $template_parameter_type_map): UnionType
        {
            if (\count($template_parameter_type_map) === 0) {
                return UnionType::empty();
            }
    Severity: Minor
    Found in src/Phan/Language/Element/Clazz.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

    Function importTraitAdaptations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function importTraitAdaptations(
            CodeBase $code_base,
            Clazz $class,
            TraitAdaptations $trait_adaptations,
            Option $type_option
    Severity: Minor
    Found in src/Phan/Language/Element/Clazz.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

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

            string $comment,
            CodeBase $code_base,
            Context $context,
            int $lineno,
            int $comment_type,
    Severity: Minor
    Found in src/Phan/Language/Element/Comment/Builder.php - About 45 mins to fix

      Function hasFlagsRecursive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function hasFlagsRecursive(CodeBase $code_base, int $flags): bool
          {
              $current = $this;
              $checked = [];
              while (true) {
      Severity: Minor
      Found in src/Phan/Language/Element/Clazz.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

      Function toStubString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function toStubString(bool $is_internal = false): string
          {
              $string = '';
      
              $union_type = $this->getNonVariadicUnionType();
      Severity: Minor
      Found in src/Phan/Language/Element/Parameter.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

      Function addReference has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addReference(FileRef $file_ref): void
          {
              if (Config::get_track_references()) {
                  // Currently, we don't need to track references to PHP-internal methods/functions/constants
                  // such as PHP_VERSION, strlen(), Closure::bind(), etc.
      Severity: Minor
      Found in src/Phan/Language/Element/Clazz.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

      Function analyzePropertyOverrides has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function analyzePropertyOverrides(CodeBase $code_base, array $original_declared_properties): void
          {
              foreach ($original_declared_properties as $property) {
                  if ($property->isOverrideIntended() && !$property->isOverride()) {
                      if ($property->checkHasSuppressIssueAndIncrementCount(Issue::CommentOverrideOnNonOverrideProperty)) {
      Severity: Minor
      Found in src/Phan/Language/Element/Clazz.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 deeply nested control flow statements.
      Open

                                  if (!$this->is_accepting_new_requests) {
                                      // If we fork, don't read any bytes in the input buffer from the worker process.
                                      $this->emitClose();
                                      return $emitted_messages;
                                  }
      Severity: Major
      Found in src/Phan/LanguageServer/ProtocolStreamReader.php - About 45 mins to fix

        Method getPropertyByNameInContext has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                CodeBase $code_base,
                string $name,
                Context $context,
                bool $is_static,
                Node $node = null,
        Severity: Minor
        Found in src/Phan/Language/Element/Clazz.php - About 45 mins to fix

          Function loadConfiguredPHPExtensionStubs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function loadConfiguredPHPExtensionStubs(CodeBase $code_base): void
              {
                  $stubs = Config::getValue('autoload_internal_extension_signatures');
                  foreach ($stubs ?: [] as $extension_name => $path_to_extension) {
                      $extension_name = (string)$extension_name;
          Severity: Minor
          Found in src/Phan/Phan.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

          Function analyzeClassConstantOverrides has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function analyzeClassConstantOverrides(CodeBase $code_base, array $original_declared_class_constants): void
              {
                  foreach ($original_declared_class_constants as $constant) {
                      if ($constant->isOverrideIntended() && !$constant->isOverride()) {
                          if ($constant->checkHasSuppressIssueAndIncrementCount(Issue::CommentOverrideOnNonOverrideConstant)) {
          Severity: Minor
          Found in src/Phan/Language/Element/Clazz.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

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

                  Context $context,
                  string $name,
                  UnionType $type,
                  int $flags,
                  FullyQualifiedMethodName $fqsen,
          Severity: Minor
          Found in src/Phan/Language/Element/Method.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (StringUtil::isNonZeroLengthString($class_description)) {
                                            return "Construct an instance of `{$class->getFQSEN()}`.\n\n$class_description";
                                        }
            Severity: Major
            Found in src/Phan/Language/Element/MarkupDescription.php - About 45 mins to fix

              Function magicPropertyFromCommentLine has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function magicPropertyFromCommentLine(
                      string $line,
                      int $i
                  ): ?Property {
                      // Note that the type of a property can be left out (@property $myVar) - This is equivalent to @property mixed $myVar
              Severity: Minor
              Found in src/Phan/Language/Element/Comment/Builder.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

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

                      Context $context,
                      string $name,
                      UnionType $type,
                      int $flags,
                      FullyQualifiedFunctionName $fqsen,
              Severity: Minor
              Found in src/Phan/Language/Element/Func.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (isset($new_lines[0])) {
                                                // @phan-suppress-next-line PhanAccessClassConstantInternal
                                                $new_lines[0] = \preg_replace(Builder::RETURN_COMMENT_REGEX, $remove_type ? '' : '`\0`', $new_lines[0]);
                                            }
                Severity: Major
                Found in src/Phan/Language/Element/MarkupDescription.php - About 45 mins to fix

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

                          Context $context,
                          string $name,
                          UnionType $type,
                          int $flags,
                          FullyQualifiedPropertyName $fqsen,
                  Severity: Minor
                  Found in src/Phan/Language/Element/Property.php - About 45 mins to fix

                    Function extractDescriptionFromDocCommentOfAncestorOfClassElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static function extractDescriptionFromDocCommentOfAncestorOfClassElement(
                            ClassElement $element,
                            CodeBase $code_base,
                            array &$checked_class_fqsens = []
                        ): ?string {
                    Severity: Minor
                    Found in src/Phan/Language/Element/MarkupDescription.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 deeply nested control flow statements.
                    Open

                                                if (isset($new_lines[0])) {
                                                    $did_build_from_phpdoc_tag = true;
                                                    // @phan-suppress-next-line PhanAccessClassConstantInternal
                                                    $new_lines[0] = \preg_replace(Builder::PARAM_COMMENT_REGEX, $remove_type ? '' : '`\0`', $new_lines[0]);
                                                }
                    Severity: Major
                    Found in src/Phan/Language/Element/MarkupDescription.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language