Showing 4,939 of 4,939 total issues
Function analyzeFunctionLike
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeFunctionLike(CodeBase $code_base, FunctionInterface $method): void
{
if (Phan::isExcludedAnalysisFile($method->getContext()->getFile())) {
// This has no side effects, so we can skip files that don't need to be analyzed
return;
- 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 isSelfOrParentCallUsingObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function isSelfOrParentCallUsingObject(CodeBase $code_base, FunctionInterface $method, Node $node): bool
{
$class_node = $node->children['class'];
if (!($class_node instanceof Node && $class_node->kind === ast\AST_NAME)) {
return false;
- 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 analyzeMethod
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function analyzeMethod(
CodeBase $code_base,
Method $method
): void {
// 1. Perform any checks that can be done immediately to rule out being able
- 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 visitConst
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitConst(Node $node): void
{
$expression = $node->children['name'];
if (!($expression instanceof Node) || $expression->kind !== ast\AST_NAME) {
return;
- 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
Avoid too many return
statements within this method. Open
return get_class($value) . '(' . $value->getRepresentationForIssue() . ')';
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return count($value) > 0 ? '[...]' : '[]';
Avoid too many return
statements within this method. Open
return '[' . \implode(', ', $result) . ']';
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $variable_description;
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return $generate_suggestion_text($similarity_values[0][2]);
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $generate_suggestion_text($similarity_values[0][2], $similarity_values[1][2]);
Avoid too many return
statements within this method. Open
return get_class($value) . '(' . $value . ')';
Avoid too many return
statements within this method. Open
return \trim(\ob_get_clean() ?: 'resource');
Avoid too many return
statements within this method. Open
return $request_obj;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $generate_suggestion_text($alternate);
Avoid too many return
statements within this method. Open
return CompletionItemKind::METHOD;