Showing 3,272 of 4,939 total issues
File Bootstrap.php
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/**
Method visitClosure
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitClosure(Node $node): Context
{
$code_base = $this->code_base;
$context = $this->context->withoutLoops();
$closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext(
Method getClassConst
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getClassConst(): ClassConstant
{
$node = $this->node;
if (!($node instanceof Node)) {
throw new AssertionError('$this->node must be a node');
Function addMethod
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function addMethod(
CodeBase $code_base,
Method $method,
Option $type_option
): void {
- 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 analyzeNode
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeNode(Node $stmts): array
{
$kind = $stmts->kind;
switch ($kind) {
// Nodes that create new scopes
- 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 generateClosure
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private static function generateClosure(array $callable_params, array $class_params): Closure
{
$key = \json_encode([$callable_params, $class_params]);
static $cache = [];
$closure = $cache[$key] ?? 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 isSimpleExpression
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private static function isSimpleExpression($arg): bool
{
if (\is_scalar($arg)) {
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 visitStaticCall
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function visitStaticCall(Node $node): Context
{
// Get the name of the method being called
$method_name = $node->children['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 createPassByReferenceArgumentInCall
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
{
if ($argument->kind === ast\AST_VAR) {
// We don't do anything with the new variable; just create it
// if it doesn't exist
- 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 updateParameterTypeByArgument
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function updateParameterTypeByArgument(
FunctionInterface $method,
Parameter $parameter,
$argument,
array $argument_types,
- 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 analyzeBinaryConditionSide
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeBinaryConditionSide(Node $var_node, $expr_node, BinaryCondition $condition): ?Context
{
'@phan-var ConditionVisitorUtil|ConditionVisitorInterface $this';
$kind = $var_node->kind;
if ($kind === ast\AST_VAR || $kind === ast\AST_DIM) {
- 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 phpParserTypeToAstNode
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected static function phpParserTypeToAstNode($type, int $line): ?ast\Node
{
if (\is_null($type)) {
return 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 astStmtClass
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private static function astStmtClass(
int $flags,
?string $name,
?\ast\Node $extends,
?\Microsoft\PhpParser\node\classinterfaceclause $implements,
- 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 checkMovedArg
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function checkMovedArg(FunctionInterface $function, array $args, Node $node, array $arg_names, array $places_set = []): void
{
$real_parameters = $function->getRealParameterList();
$parameters = $function->getParameterList();
/** @var associative-array<string,?int> maps lowercase param names to their unique index, or 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 visitMatchArmList
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function visitMatchArmList(Node $node): void
{
$children = $node->children;
if (!$children) {
// This plugin will never emit errors if there are 0 elements.
- 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 accept
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function accept(CodeBase $code_base, Closure $file_path_lister, Responder $responder, bool $fork): ?Request
{
FileCache::clear();
$request = $responder->getRequestData();
Method visitMethodCall
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitMethodCall(Node $node): UnionType
{
$method_name = $node->children['method'] ?? '';
// Give up on any complicated nonsense where the
MixedType
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class MixedType extends NativeType
{
/** @phan-override */
public const NAME = 'mixed';
VoidType
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
final class VoidType extends NativeType implements LiteralTypeInterface
{
/** @phan-override */
public const NAME = 'void';
LiteralStringType
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
final class LiteralStringType extends StringType implements LiteralTypeInterface
{
public const MINIMUM_MAX_STRING_LENGTH = 50;