Showing 3,272 of 4,939 total issues
Function normalizeForStatement
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function normalizeForStatement(Node $node): array
{
// Repeatedly apply these rules
while (true) {
$for_cond_list = $node->children['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 checkInvalidUnpackKeyType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
{
$is_invalid_because_associative = false;
if (!$is_array_spread) {
foreach ($union_type->getTypeSet() as $type) {
- 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 initInner
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function initInner(): void
{
/**
* @param 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 getClassConst
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getClassConst(): ClassConstant
{
$node = $this->node;
if (!($node instanceof Node)) {
throw new AssertionError('$this->node must be a 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 extractInfoFromOpcache
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function extractInfoFromOpcache(string $contents): array
{
$lines = explode("\n", $contents);
$result = [];
foreach ($lines as $line) {
- 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 getMethodsForClassName
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getMethodsForClassName(string $class_name): ?array
{
$class_name_lc = strtolower($class_name);
$class_name_file_map = $this->getFoldersForClassNameList();
$class_name_files = $class_name_file_map[$class_name_lc] ?? 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 finalizeProcess
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function finalizeProcess(CodeBase $code_base): void
{
echo "<" . "?php declare(strict_types=1);\n";
ksort(self::$calls);
foreach (self::$calls as $namespace => $name_set) {
- 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 findCycles
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function findCycles(array $destination_map): array
{
$result = [];
while (count($destination_map) > 0) {
reset($destination_map);
- 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 analyzeFunctionLike
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeFunctionLike(CodeBase $code_base, FunctionInterface $method): void
{
if (Phan::isExcludedAnalysisFile($method->getContext()->getFile())) {
// This has no side effects, so we can skip files that don't need to be analyzed
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 streamPutContents
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function streamPutContents($stream, string $file_contents): void
{
try {
while (strlen($file_contents) > 0) {
$bytes_written = fwrite($stream, $file_contents);
- 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 ensureASTParserExists
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function ensureASTParserExists(): void
{
if (Config::getValue('use_polyfill_parser')) {
return;
}
Method build
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build(): Comment
{
foreach ($this->lines as $i => $line) {
if (\strpos($line, '@') === false) {
continue;
Method applyOverride
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function applyOverride(string $key, $value): void
{
switch ($key) {
case 'param':
foreach ($value as $parameter) {
Method internalFunctionSignatureMap
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function internalFunctionSignatureMap(int $target_php_version): array
{
static $php73_map = [];
if (!$php73_map) {
Method asClassList
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function asClassList(
CodeBase $code_base,
Context $context
): Generator {
// Iterate over each viable class type to see if any
Method checkMultipleReturns
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkMultipleReturns(array $possible_return_nodes): void
{
if (\count($possible_return_nodes) <= 1) {
return;
}
Method analyzeReferenceCounts
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function analyzeReferenceCounts(CodeBase $code_base): void
{
// Check to see if dead code detection is enabled. Keep
// in mind that the results here are just a guess and
// we can't tell with certainty that anything is
Method checkComplexIsset
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkComplexIsset(Node $var_node): Context
{
$context = $this->context;
if ($var_node->kind === ast\AST_DIM) {
$expr_node = $var_node;
Method visitArrowFunc
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitArrowFunc(Node $node): Context
{
$code_base = $this->code_base;
$context = $this->context->withoutLoops();
$closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext(
Method normalizeListTypesInDimAssignment
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function normalizeListTypesInDimAssignment(UnionType $assign_type, UnionType $right_type): UnionType
{
// Offsets of $can_cast:
// 0. lazily computed: True if list types should be kept as-is.
// 1. lazily computed: Should this cast from a regular array to an associative array?