Showing 3,272 of 4,939 total issues
Function setSearchString
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function setSearchString(string $search_string): void
{
// XXX improve parsing this
$parts = \array_map('trim', \explode('->', $search_string));
$result = [];
- 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 extractCombinationGroup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function extractCombinationGroup(): void
{
$original_matches = $this->matches;
$possible_matches = $original_matches;
$pattern = $this->pattern;
- 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 extractVariables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function extractVariables($node): array
{
if (!$node instanceof 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 shouldSuppressIssueTypeInFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function shouldSuppressIssueTypeInFile(string $issue_type, string $file): bool
{
$suppressed_by_file = \in_array($issue_type, $this->file_suppressions[$file] ?? [], true);
if ($suppressed_by_file) {
return true;
- 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 visitCatch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitCatch(Node $node): Context
{
// @phan-suppress-next-line PhanThrowTypeAbsentForCall
$union_type = UnionTypeVisitor::unionTypeFromClassNode(
$this->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 analyzePropertyAssignmentStrict
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function analyzePropertyAssignmentStrict(Property $property, UnionType $assignment_type, Node $node): void
{
$type_set = $assignment_type->getTypeSet();
if (\count($type_set) < 2) {
throw new AssertionError('Expected to have at least two types when checking if types match in strict mode');
- 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 analyzeValueNodeOfShapedArray
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeValueNodeOfShapedArray(
UnionType $element_type,
$value_node
): void {
if (!$value_node instanceof Node) {
- 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 checkAllNamedArgumentsPassed
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function checkAllNamedArgumentsPassed(
CodeBase $code_base,
Context $context,
int $lineno,
FunctionInterface $method,
- 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 visitStaticCall
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitStaticCall(Node $node): Context
{
$call = $node->children['class'];
if ($call instanceof Node && $call->kind === \ast\AST_NAME) {
- 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 visitUnaryOp
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitUnaryOp(Node $node): Context
{
if ($node->flags === flags\UNARY_SILENCE) {
$expr = $node->children['expr'];
if ($expr instanceof Node) {
- 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 checkUnionTypeCompatibility
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function checkUnionTypeCompatibility(?Node $type): void
{
if (!$type) {
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 checkExpressionInDynamicString
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function checkExpressionInDynamicString(Node $expr_node): void
{
$code_base = $this->code_base;
$context = $this->context;
$type = UnionTypeVisitor::unionTypeFromNode(
- 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 analyzeDuplicateFunction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzeDuplicateFunction(
CodeBase $code_base,
FunctionInterface $method
): void {
$fqsen = $method->getFQSEN();
- 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 isAssignmentOrNestedAssignment
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function isAssignmentOrNestedAssignment(Node $node): ?bool
{
$parent_node_list = $this->parent_node_list;
$parent_node = \end($parent_node_list);
if (!$parent_node instanceof Node) {
- 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 computeColumnForTokenAtIndex
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function computeColumnForTokenAtIndex(array $tokens, int $i, int $desired_line): int
{
if ($i <= 0) {
return 1;
}
- 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 computeStatusOfCall
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function computeStatusOfCall(Node $node): int
{
$expression = $node->children['expr'];
if ($expression instanceof Node) {
if ($expression->kind !== \ast\AST_NAME) {
- 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 computeLabelSet
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function computeLabelSet(Node $node): array
{
$result = [];
$nodes = [];
while (true) {
- 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 checkDeprecatedUnparenthesizedConditional
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function checkDeprecatedUnparenthesizedConditional(Node $node, Node $cond): void
{
if ($cond->flags & flags\PARENTHESIZED_CONDITIONAL) {
// The condition is unambiguously parenthesized.
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 getReturnTypesOfArray
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getReturnTypesOfArray(Context $context, Node $node): \Generator
{
if (\count($node->children) === 0) {
// Possibly unreachable (array shape would be returned instead)
yield $node->lineno => [MixedType::instance(false)->asPHPDocUnionType(), $node];
- 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 visitNew
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitNew(Node $node): Context
{
$class_list = [];
try {
$context_node = new ContextNode(
- 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"