Showing 3,272 of 4,939 total issues
CodeBase
has 110 functions (exceeds 20 allowed). Consider refactoring. Open
class CodeBase
{
/**
* @var Map<FullyQualifiedClassName,Clazz>
* A map from FQSEN to an internal or user defined class
FunctionLikeDeclarationType
has 110 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class FunctionLikeDeclarationType extends Type implements FunctionInterface
{
// Subclasses will override this
public const NAME = '';
File EmptyUnionType.php
has 865 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language;
KindVisitorImplementation
has 107 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class KindVisitorImplementation implements KindVisitor
{
/**
* The fallback implementation for node kinds where the subclass visitor
File UseReturnValuePlugin.php
has 823 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
Function processGraph
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
public function processGraph(array $cached_graph = null): void
{
$cmd = $_ENV['PDEP_CMD'];
$mode = $_ENV['PDEP_MODE'];
$this->depth = (int)$_ENV['PDEP_DEPTH'];
- 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 ConditionVisitor.php
has 801 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
Method init
has 378 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function init(): void
{
self::$noop = static function (Node $_): string {
return '(unknown)';
};
File VariableTrackerVisitor.php
has 761 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal\VariableTracker;
Function analyzeParameterList
has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeParameterList(
CodeBase $code_base,
FunctionInterface $method,
Node $node,
Context $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
File ArrayShapeType.php
has 741 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
UnionTypeVisitor
has 90 functions (exceeds 20 allowed). Consider refactoring. Open
class UnionTypeVisitor extends AnalysisVisitor
{
/**
* If an dynamic unpacked array has more elements than this, then give up on building up the union type
*/
Function visitSwitchList
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
public function visitSwitchList(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
- 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 usage
has 338 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
{
global $argv;
if ($msg !== '') {
Function analyzePrintfPattern
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
{
// Given a node, extract the printf directive and whether or not it could be translated
$primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_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
TolerantASTConverter
has 86 functions (exceeds 20 allowed). Consider refactoring. Open
class TolerantASTConverter
{
// The latest stable version of php-ast.
// For something != 70, update the library's release.
public const AST_VERSION = 70;
Function check_fields
has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring. Open
function check_fields(string $function_name, array $fields, array $signatures): void
{
$return_type = $fields[0]; // TODO: Check type
if (!is_string($return_type)) {
throw new InvalidArgumentException("Invalid return type: " . json_encode($return_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
File NegatedConditionVisitor.php
has 702 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
File BinaryOperatorFlagVisitor.php
has 697 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
Function getElementsFromElementListForDeferredAnalysis
has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring. Open
private static function getElementsFromElementListForDeferredAnalysis(
CodeBase $code_base,
iterable $element_list,
int $total_count,
int &$i
- 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"