Showing 3,272 of 4,939 total issues
Function visitDim
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function visitDim(Node $node): Context
{
$expr_node = $node->children['expr'];
if (!($expr_node instanceof Node)) {
$this->emitIssue(
- Read upRead up
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 analyzePassByReferenceArgument
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzePassByReferenceArgument(
CodeBase $code_base,
Context $context,
Node $argument,
array $argument_list,
- Read upRead up
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 visitReturn
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function visitReturn(Node $node): Context
{
$context = $this->context;
// Make sure we're actually returning from a method.
if (!$context->isInFunctionLikeScope()) {
- Read upRead up
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 phpParserStmtlistToAstNode
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function phpParserStmtlistToAstNode($parser_nodes, ?int $lineno, bool $return_null_on_empty = false): ?\ast\Node
{
if ($parser_nodes instanceof PhpParser\Node\Statement\CompoundStatementNode) {
$parser_nodes = $parser_nodes->statements;
} elseif ($parser_nodes instanceof PhpParser\Node\StatementNode) {
- Read upRead up
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 visitConditional
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function visitConditional(Node $node): UnionType
{
$cond_node = $node->children['cond'];
$cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
// For the shorthand $a ?: $b, the cond node will be the truthy value.
- Read upRead up
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 normalizeIfStatement
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function normalizeIfStatement(Node $original_node): array
{
$nodes = [$original_node];
// Repeatedly apply these rules
do {
- Read upRead up
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 getFunction
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function getFunction(
string $function_name,
bool $is_function_declaration = false,
bool $return_placeholder_for_undefined = false
): FunctionInterface {
- Read upRead up
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 visitVar
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitVar(Node $node): UnionType
{
// $$var or ${...} (whose idea was that anyway?)
$name_node = $node->children['name'];
if (($name_node instanceof Node)) {
Method finishAnalyzingRemainingStatements
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function finishAnalyzingRemainingStatements(
CodeBase $code_base,
?Request $request,
array $analyze_file_path_list,
array $temporary_file_mapping
Method analyzeParameterListForCallback
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeParameterListForCallback(
CodeBase $code_base,
FunctionInterface $method,
array $arg_nodes,
Context $context,
Method initTypeModifyingClosuresForVisitCall
has 105 lines of code (exceeds 25 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
Method computeIntOrFloatOperationResult
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function computeIntOrFloatOperationResult(
Node $node,
UnionType $left,
UnionType $right
): UnionType {
File Debug.php
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan;
Method analyzeBackwardCompatibility
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function analyzeBackwardCompatibility(): void
{
if (!Config::get_backward_compatibility_checks()) {
return;
}
File DeprecateAliasPlugin.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use Phan\CodeBase;
Function fromNode
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public static function fromNode(
Context $context,
CodeBase $code_base,
Node $node
): Parameter {
- Read upRead up
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 asFunctionInterfaceOrNull
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function asFunctionInterfaceOrNull(CodeBase $code_base, Context $context): ?FunctionInterface
{
if (\count($this->field_types) !== 2) {
Issue::maybeEmit(
$code_base,
- Read upRead up
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 extractTypePartsForStringInContext
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private static function extractTypePartsForStringInContext(string $type_string): array
{
static $cache = [];
$parts = $cache[$type_string] ?? null;
if (\is_array($parts)) {
- Read upRead up
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 createSwitchConditionAnalyzer
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function createSwitchConditionAnalyzer($switch_case_node): array
{
$switch_kind = ($switch_case_node->kind ?? null);
try {
if ($switch_kind === ast\AST_VAR) {
- Read upRead up
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 dumpClassDot
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function dumpClassDot(string $title, array $graph = null): void
{
if (!$graph) {
$graph = $this->cgraph;
}
- Read upRead up
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"