Showing 3,272 of 4,939 total issues
Function visitThrow
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function visitThrow(Node $node): void
{
$code_base = $this->code_base;
$context = $this->context;
$union_type = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $node->children['expr']);
- 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 analyze
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public static function analyze(
FunctionInterface $method,
Node $node,
Context $context,
CodeBase $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
Method parseCommentLine
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseCommentLine(int $i, string $line): void
{
// https://secure.php.net/manual/en/regexp.reference.internal-options.php
// (?i) makes this case-sensitive, (?-1) makes it case-insensitive
// phpcs:ignore Generic.Files.LineLength.MaxExceeded
Method dumpGraphML
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function dumpGraphML(string $title, array $graph, bool $is_classgraph, bool $hide_labels): void
{
$node_id = 0;
$edge_id = 0;
Method fromNode
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromNode(
Context $context,
CodeBase $code_base,
Node $node,
FullyQualifiedFunctionName $fqsen
Method visitMatchArmList
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitMatchArmList(Node $node): Context
{
// Make a copy of the internal context so that we don't
// leak any changes within the closed context to the
// outer scope
Method checkCall
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkCall(FunctionInterface $function, array $args, Node $node): void
{
$arg_names = [];
foreach ($args as $i => $arg_node) {
$name = self::extractName($arg_node);
File UnknownElementTypePlugin.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\Node;
File UseReturnValueVisitor.php
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal\UseReturnValuePlugin;
Method analyzeProp
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeProp(Node $node, bool $is_static): UnionType
{
// Either expr(instance) or class(static) is set
$expr_node = $node->children['expr'] ?? null;
try {
Function resolveTemplateType
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function resolveTemplateType(
CodeBase $code_base,
UnionType $object_union_type
): Method {
$defining_fqsen = $this->getDefiningClassFQSEN();
- 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 visitIf
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function visitIf(Node $node): Context
{
$context = $this->context->withLineNumberStart(
$node->lineno
);
- 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 getConfigErrors
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function getConfigErrors(array $configuration): array
{
/**
* @param mixed $value
*/
- 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 finalizeProcess
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function finalizeProcess(CodeBase $code_base): void
{
if (!self::$use_dynamic) {
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 visitProp
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function visitProp(Node $node): Context
{
// Get class list first, warn if the class list is invalid.
try {
$class_list = (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"
Further reading
Function checkAbstractStaticMethodCall
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private static function checkAbstractStaticMethodCall(
FunctionInterface $method,
Node $node,
Context $context,
CodeBase $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 analyzeCallToFunctionLike
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeCallToFunctionLike(
FunctionInterface $method,
Node $node
): void {
$code_base = $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
NativeType
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class NativeType extends Type
{
public const NAME = '';
/** @phan-override */
File SuspiciousParamOrderPlugin.php
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\Node;
Method combineScopeList
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function combineScopeList(array $scope_list): Context
{
if (\count($scope_list) < 2) {
throw new AssertionError("Expected at least two child contexts in " . __METHOD__);
}