Showing 3,272 of 4,939 total issues
Function astFlagDescription
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function astFlagDescription(int $flags, int $kind): string
{
[$exclusive, $combinable] = self::getFlagInfo();
$flag_names = [];
if (isset($exclusive[$kind])) {
- 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 extractArrayArgs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function extractArrayArgs($arg_array_node)
{
if (($arg_array_node instanceof Node) && $arg_array_node->kind === \ast\AST_ARRAY) {
$arguments = [];
foreach ($arg_array_node->children as $child) {
- 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 sanityCheckErrorList
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function sanityCheckErrorList(array $error_list): void
{
$error_map = [];
$unique_type_id_set = [];
foreach ($error_list as $error) {
- 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 guessUnionType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function guessUnionType(FunctionInterface $function): UnionType
{
if ($function instanceof Method) {
// convert __set to void, __sleep to string[], etc.
$union_type = $function->getUnionTypeOfMagicIfKnown();
- 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 visitFor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitFor(Node $node): void
{
$cond_list = $node->children['cond'];
if (!$cond_list 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 findVariableReuse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function findVariableReuse(array $variables): void
{
if (!$variables) {
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 visitFor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitFor(Node $node): VariableTrackingScope
{
$this->checkIsSideEffectFreeLoopNode($node);
$top_level_statement = $this->top_level_statement;
- 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 visitExprList
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitExprList(Node $node): Context
{
$children = $node->children;
$count = \count($children);
if ($count > 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 getPregMatchUnionType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getPregMatchUnionType(
CodeBase $code_base,
Context $context,
array $argument_list
): UnionType {
- 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 maybeWarnWriteOnlyProperty
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function maybeWarnWriteOnlyProperty(CodeBase $code_base, Property $property): void
{
if ($property->isWriteOnly()) {
// Handle annotations such as property-write and phan-write-only
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 maybeWarnReadOnlyProperty
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function maybeWarnReadOnlyProperty(CodeBase $code_base, Property $property): void
{
if ($property->isReadOnly()) {
// Handle annotations such as property-read and phan-read-only.
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 visitExprList
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitExprList(Node $node): Context
{
$children = $node->children;
$count = \count($children);
if ($count > 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 handleThisPropertyAssignmentInLocalScopeByName
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function handleThisPropertyAssignmentInLocalScopeByName(Node $node, string $prop_name): void
{
if ($this->dim_depth === 0) {
$new_type = $this->right_type;
} else {
- 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 maybeWarnProvidingUnusedParameter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function maybeWarnProvidingUnusedParameter(
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 visitCall
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitCall(Node $node): Context
{
$raw_function_name = self::getFunctionName($node);
if (!\is_string($raw_function_name)) {
return $this->context;
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitConditional(Node $node): ?bool
{
$cond = $node->children['cond'];
if ($cond instanceof Node) {
$result = $this->__invoke($cond);
- 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 shouldSkipNestedAssignDim
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static function shouldSkipNestedAssignDim(array $parent_node_list): bool
{
$cur_parent_node = \end($parent_node_list);
for (;; $cur_parent_node = $prev_parent_node) {
$prev_parent_node = \prev($parent_node_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 visitContinue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitContinue(Node $node): Context
{
$nodes = $this->parent_node_list;
$depth = $node->children['depth'] ?? 1;
if (!\is_int($depth)) {
- 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 computeStatusOfBlock
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function computeStatusOfBlock(array $block): int
{
$maybe_status = 0;
foreach ($block as $child) {
if ($child === null) {
- 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 visitClassConstDecl
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassConstDecl(Node $node): Context
{
$class = $this->context->getClassInScope($this->code_base);
foreach ($node->children as $child_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"