Showing 3,272 of 4,939 total issues
Function phan_print_backtrace
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function phan_print_backtrace(bool $is_crash = false, int $frames_to_skip = 2): void
{
// Uncomment this if even trying to print the details would crash
/*
ob_start();
- 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 visitSwitchList
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function visitSwitchList(Node $node): VariableTrackingScope
{
$outer_scope = $this->scope;
$inner_scope_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 getAnalyzeFunctionCallClosuresStatic
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param list<Node|int|float|string> $args
*/
- 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 typeCheckDimAssignment
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function typeCheckDimAssignment(UnionType $assign_type, Node $node): UnionType
{
static $int_or_string_type = null;
static $string_array_type = null;
static $simple_xml_element_type = 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 analyzeCallableWithArgumentTypes
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function analyzeCallableWithArgumentTypes(
array $argument_types,
FunctionInterface $method,
array $arguments = [],
bool $erase_old_return_type = 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 analyzeIncOrDec
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeIncOrDec(Node $node): Context
{
$var = $node->children['var'];
$old_type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var);
if (!$old_type->canCastToUnionType(UnionType::fromFullyQualifiedPHPDocString('int|string|float'))) {
- 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 aliasTargetMapFromUseNode
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function aliasTargetMapFromUseNode(
Node $node,
string $prefix = '',
int $flags = 0
): array {
- 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 analyzeUnsetProp
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeUnsetProp(Node $node): Context
{
$expr_node = $node->children['expr'];
$context = $this->context;
if (!($expr_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 checkForInfiniteRecursionWithSameArgs
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function checkForInfiniteRecursionWithSameArgs(Node $node, FunctionInterface $method): void
{
$argument_list_node = $node->children['args'];
$parameter_list = $method->getParameterList();
if (\count($argument_list_node->children) !== \count($parameter_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 functionLikeFQSENListFromNode
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function functionLikeFQSENListFromNode($node): array
{
$orig_node = $node;
if ($node instanceof Node) {
$node = (new ContextNode($this->code_base, $this->context, $node))->getEquivalentPHPValue();
- 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 getReturnTypeOverrides
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getReturnTypeOverrides(CodeBase $code_base): array
{
$string_union_type = StringType::instance(false)->asPHPDocUnionType();
/**
* @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
- 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 afterAnalyzeFile
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function afterAnalyzeFile(
CodeBase $code_base,
Context $context,
string $file_contents,
Node $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 getClassForVariable
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function getClassForVariable(Node $expr): Clazz
{
if ($expr->kind !== ast\AST_VAR) {
// TODO: Support static properties, (new X()), other expressions with inferable types
throw new NodeException($expr, 'expected simple variable');
- 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 nodeCanBeStatic
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static function nodeCanBeStatic(CodeBase $code_base, FunctionInterface $method, $node): bool
{
if (!($node instanceof Node)) {
if (is_array($node)) {
foreach ($node 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"
Further reading
Function afterAnalyzeFile
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function afterAnalyzeFile(
CodeBase $code_base,
Context $context,
string $file_contents,
Node $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
File FullyQualifiedGlobalStructuralElement.php
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\FQSEN;
File ClosureReturnTypeOverridePlugin.php
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
Method merge
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function merge(array $union_types, bool $normalize_array_shapes = true): UnionType
{
$n = \count($union_types);
if ($n < 2) {
return \reset($union_types) ?: UnionType::$empty_instance;
Method warnAboutVariableGraph
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function warnAboutVariableGraph(
Node $method_node,
VariableGraph $graph,
array $issue_overrides_for_definition_ids
): void {
Method __construct
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
array $process_task_data_iterator,
Closure $startup_closure,
Closure $task_closure,
Closure $shutdown_closure