Showing 3,272 of 4,939 total issues
Function setValue
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function setValue(string $name, $value): void
{
self::$configuration[$name] = $value;
switch ($name) {
case 'ignore_undeclared_functions_with_known_signatures':
- 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 computeIssueSuppressionList
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static function computeIssueSuppressionList(
string $file_contents
): array {
if (!\preg_match(self::SUPPRESS_ISSUE_REGEX, $file_contents)) {
// If the **file** doesn't contain the regex we're looking for,
- 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 dumpGraphML
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
{
$node_id = 0;
$edge_id = 0;
- 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 visitDim
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function visitDim(Node $node): Context
{
if (!Config::get_backward_compatibility_checks()) {
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 updateTargetDimWithType
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function updateTargetDimWithType(Node $assign_op_node, Closure $get_type): Context
{
$node = $assign_op_node->children['var'];
if (!$node instanceof Node) {
// Should be impossible as currently called, but warn anyway.
- 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 updateVariableToBeNotEqual
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
final public function updateVariableToBeNotEqual(
Node $var_node,
$expr,
Context $context = null
): 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 visitBinaryAdd
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function visitBinaryAdd(Node $node): UnionType
{
$code_base = $this->code_base;
$context = $this->context;
$left = 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 createArrayShapeType
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function createArrayShapeType(array $key_set): ArrayShapeType
{
$field_types = [];
foreach ($key_set as $key => $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 visitTypeUnion
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function visitTypeUnion(Node $node): UnionType
{
// TODO: Validate that there aren't any duplicates
if (\count($node->children) === 1) {
// Might be possible due to the polyfill in the future.
- 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 getEquivalentArraySet
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function getEquivalentArraySet(Node $node): ?array
{
$elements = [];
$context_node = null;
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"
Further reading
Function findEndLine
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function findEndLine(int $lineno, Node $search_node): int
{
for ($node_index = count($this->parent_node_list) - 1; $node_index >= 0; $node_index--) {
$node = $this->parent_node_list[$node_index] ?? null;
if (!$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 analyzeReturnValue
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeReturnValue($expr_node, int $lineno, array &$sleep_properties): void
{
$context = clone($this->context)->withLineNumberStart($lineno);
if (!($expr_node instanceof Node)) {
$this->emitPluginIssue(
- 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 renderLongProgress
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
{
$buf = '';
if ($msg !== self::$current_progress_state_long_progress) {
switch ($msg) {
Method phan_repl_help
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function phan_repl_help($value = "\x00extended_help"): void
{
if ($value === "\x00extended_help") {
echo "Phan " . CLI::PHAN_VERSION . " CLI autocompletion utilities.\n";
echo "Type help(\$value); or help('function or constant or class name'); for help.\n";
Method visitWhile
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitWhile(Node $node): Context
{
$context = $this->context->withLineNumberStart(
$node->lineno
)->withEnterLoop($node);
Method extractIncrementDirections
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function extractIncrementDirections(CodeBase $code_base, Context $context, $cond_node): array
{
if (!$cond_node instanceof Node) {
return [];
}
Method updateTargetDimWithType
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateTargetDimWithType(Node $assign_op_node, Closure $get_type): Context
{
$node = $assign_op_node->children['var'];
if (!$node instanceof Node) {
// Should be impossible as currently called, but warn anyway.
LanguageServer
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class LanguageServer extends AdvancedJsonRpc\Dispatcher
{
/**
* Handles workspace/* method calls
*
ArrayType
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class ArrayType extends IterableType
{
/** @phan-override */
public const NAME = 'array';
NegatedConditionVisitor
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class NegatedConditionVisitor extends KindVisitorImplementation implements ConditionVisitorInterface
{
// TODO: if (a || b || c || d) might get really slow, due to creating both ConditionVisitor and NegatedConditionVisitor
use ConditionVisitorUtil;