Showing 3,272 of 4,939 total issues

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

    public function asClassFQSENList(
        Context $context
    ): Generator {
        // Iterate over each viable class type to see if any
        // have the constant we're looking for
Severity: Minor
Found in src/Phan/Language/UnionType.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 analyzeMatchArm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeMatchArm(
        Context $child_context,
        Context $fallthrough_context,
        ?Closure $match_variable_condition,
        ?Closure $match_variable_negated_condition,
Severity: Minor
Found in src/Phan/BlockAnalysisVisitor.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 analyzeForeachIteration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function analyzeForeachIteration(Context $context, UnionType $expression_union_type, Node $node): Context
    {
        $code_base = $this->code_base;
        $value_node = $node->children['value'];
        if ($value_node instanceof Node) {
Severity: Minor
Found in src/Phan/BlockAnalysisVisitor.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 suggestSimilarClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function suggestSimilarClass(
        CodeBase $code_base,
        Context $context,
        FullyQualifiedClassName $class_fqsen,
        ?Closure $filter = null,
Severity: Minor
Found in src/Phan/IssueFixSuggester.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 filterSimilarProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function filterSimilarProperties(CodeBase $code_base, Context $context, array $property_map, bool $is_static): array
    {
        $class_fqsen_in_current_scope = self::maybeGetClassInCurrentScope($context);
        $candidates = [];
        foreach ($property_map as $property_name => $property) {
Severity: Minor
Found in src/Phan/IssueFixSuggester.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 runWithoutPcntl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function runWithoutPcntl(CodeBase $code_base, Closure $file_path_lister): void
    {
        // This is a single threaded server, it only analyzes one TCP request at a time
        $socket_server = self::createDaemonStreamSocketServer();
        try {
Severity: Minor
Found in src/Phan/Daemon.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 visitStaticCall has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitStaticCall(Node $node): void
    {
        [$parent, $used] = $this->findNonUnaryParentNode($node);
        if (!$parent) {
            //fwrite(STDERR, "No parent in " . __METHOD__ . "\n");

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 getParameterCategory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getParameterCategory(Node $method_node): string
    {
        $kind = $method_node->kind;
        if ($kind === ast\AST_CLOSURE) {
            return Issue::UnusedClosureParameter;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTrackerPlugin.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 phan_output_ast_installation_instructions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function phan_output_ast_installation_instructions(): void
{
    require_once __DIR__ . '/Library/StringUtil.php';
    $ini_path = php_ini_loaded_file() ?: '(php.ini path could not be determined - try creating one at ' . dirname(PHP_BINARY) . '\\php.ini as a new empty file, or one based on php.ini.development or php.ini.production)';
    $configured_extension_dir = ini_get('extension_dir');
Severity: Minor
Found in src/Phan/Bootstrap.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 computeCombinedDefUses has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function computeCombinedDefUses(): array
    {
        $combined_def_use_map = [];
        foreach ($this->def_uses as $var_name => $def_use_map) {
            $is_used_by_shared_state = (($this->variable_types[$var_name] ?? 0) & self::IS_REFERENCE_OR_GLOBAL_OR_STATIC) !== 0;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableGraph.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 visitClosure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitClosure(Node $node): VariableTrackingScope
    {
        foreach ($node->children['uses']->children ?? [] as $closure_use) {
            if (!($closure_use instanceof Node)) {
                continue;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableTrackerVisitor.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 computeCommentNameDocumentationMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function computeCommentNameDocumentationMap(): array
    {
        // Hackish way of extracting comment lines from Config::DEFAULT_CONFIGURATION
        // @phan-suppress-next-line PhanPossiblyFalseTypeArgumentInternal
        $config_file_lines = \explode("\n", \file_get_contents(\dirname(__DIR__) . '/Config.php'));
Severity: Minor
Found in src/Phan/Config/Initializer.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 computeCombinedUseDefs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function computeCombinedUseDefs(): array
    {
        $combined_use_def_map = [];
        foreach ($this->def_uses as $var_name => $def_use_map) {
            $is_used_by_shared_state = (($this->variable_types[$var_name] ?? 0) & self::IS_REFERENCE_OR_GLOBAL_OR_STATIC) !== 0;
Severity: Minor
Found in src/Phan/Plugin/Internal/VariableTracker/VariableGraph.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 convertToString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function convertToString($token, string $file_contents): string
    {
        if (is_object($token)) {
            if (isset($token->string_replacement)) {
                return $token->string_replacement;
Severity: Minor
Found in src/Phan/Plugin/Internal/PhantasmPlugin.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 determineTargetPHPVersion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function determineTargetPHPVersion(array $composer_settings): array
    {
        $php_version_constraint = $composer_settings['require']['php'] ?? null;
        if (!$php_version_constraint || !is_string($php_version_constraint)) {
            return [null, ['TODO: Choose a target_php_version for this project, or leave as null and remove this comment']];
Severity: Minor
Found in src/Phan/Config/Initializer.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 initTypeModifyingClosuresForVisitCall has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function initTypeModifyingClosuresForVisitCall(): array
    {
        $make_direct_assertion_callback = static function (string $union_type_string): Closure {
            $asserted_union_type = UnionType::fromFullyQualifiedRealString(
                $union_type_string
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitor.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 visitUnaryOp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitUnaryOp(Node $node): Context
    {
        $expr_node = $node->children['expr'];
        $flags = $node->flags;
        if ($flags !== flags\UNARY_BOOL_NOT) {
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitor.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 visitExprList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitExprList(Node $node): Context
    {
        $children = $node->children;
        $count = \count($children);
        if ($count > 1) {
Severity: Minor
Found in src/Phan/Analysis/LoopConditionVisitor.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 visitUnaryOp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitUnaryOp(Node $node): Context
    {
        $expr_node = $node->children['expr'];
        $flags = $node->flags;
        if ($flags !== flags\UNARY_BOOL_NOT) {
Severity: Minor
Found in src/Phan/Analysis/NegatedConditionVisitor.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 analyzeClassAssertion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function analyzeClassAssertion($object_node, $expr_node): ?Context
    {
        if (!($object_node instanceof Node)) {
            return null;
        }
Severity: Minor
Found in src/Phan/Analysis/ConditionVisitorUtil.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