Showing 3,272 of 4,939 total issues
Function filterSimilarMethods
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function filterSimilarMethods(CodeBase $code_base, Context $context, array $methods, bool $is_static): array
{
$class_fqsen_in_current_scope = self::maybeGetClassInCurrentScope($context);
$candidates = [];
- 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 deeply nested control flow statements. Open
if (!$current_function->isStatic()) {
$suggestions[] = '$this->' . $variable_name;
}
Method suggestSimilarClass
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CodeBase $code_base,
Context $context,
FullyQualifiedClassName $class_fqsen,
?Closure $filter = null,
string $prefix = null,
Function generateSuppressIssueSummary
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function generateSuppressIssueSummary(string $baseline_summary_type): string
{
if ($baseline_summary_type === 'none') {
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 visitClassConst
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassConst(Node $node): void
{
if (!isset($node->tolerant_ast_node)) {
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 walkcGraph
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function walkcGraph(array $newgraph, string $node, int $depth = 0): array
{
static $i = 0;
static $visited = [];
- 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 deeply nested control flow statements. Open
if ($file == $v) {
$v = $cl;
goto cfound;
}
Avoid deeply nested control flow statements. Open
if (!Config::get_quick_mode()) {
$analyzer = new PostOrderAnalysisVisitor($code_base, $context, []);
$analyzer->analyzeCallableWithArgumentTypes([$passed_array_element_types], $filter_function);
}
Function yieldSuppressionCommentsPhpToken
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function yieldSuppressionCommentsPhpToken(
string $file_contents
): Generator {
// @phan-suppress-next-line PhanUndeclaredClassMethod missing in php 8 before 8.0.0RC4
foreach (PhpToken::tokenize($file_contents) as $token) {
- 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 createClosures
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function createClosures(): array
{
/**
* @return ?FileEditSet
*/
- 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 getOrderKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getOrderKey(): string
{
$is_analyzed_order = Phan::isExcludedAnalysisFile($this->context->getFile()) ? "1" : "0";
switch ($this->kind) {
case self::KIND_CLASS:
- 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 shouldSuppressIssue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CodeBase $code_base,
Context $context,
string $issue_type,
int $lineno,
array $parameters,
Function addEntriesForGlobalElements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function addEntriesForGlobalElements(
CtagsEntrySet $entries,
CodeBase $code_base
): void {
foreach ($code_base->getFunctionMap() as $function_fqsen => $function) {
- 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 shouldSuppressIssue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CodeBase $code_base,
Context $context,
string $issue_type,
int $lineno,
array $parameters,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $type,
int $category,
int $severity,
string $template_raw,
int $remediation_difficulty,
Method emitWithParameters
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $type,
string $file,
int $line,
array $template_parameters,
Suggestion $suggestion = null,
Function analyzeFunctionLike
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeFunctionLike(Node $node): void
{
if (!$this->context->isInFunctionLikeScope()) {
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 analyzeMethod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function analyzeMethod(
CodeBase $code_base,
Method $method
): void {
if ($method->isFromPHPDoc()) {
- 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 checkSingleDefinitionReferenceOrGlobalOrStatic
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function checkSingleDefinitionReferenceOrGlobalOrStatic(
VariableGraph $graph,
string $variable_name,
array $issue_overrides_for_definition_ids
): void {
- 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 checkUselessScalarComparison
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Node $node,
UnionType $left,
UnionType $right,
$left_node,
$right_node,