Showing 3,272 of 4,939 total issues
FallbackUnionTypeVisitor
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class FallbackUnionTypeVisitor extends KindVisitorImplementation
{
/**
* @var CodeBase
* The code base within which we're operating
Method visitForeach
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitForeach(Node $node): Context
{
$code_base = $this->code_base;
$context = $this->context;
$context->setLineNumberStart($node->lineno);
Method analyzeGenericArrayAssignment
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeGenericArrayAssignment(Node $node): void
{
// Figure out the type of elements in the list
$right_type = $this->right_type;
if ($right_type->isEmpty()) {
Method main
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function main(): void
{
error_reporting(E_ALL);
ini_set('memory_limit', '2G');
global $argv;
Function locateNamespaceUseDefinition
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function locateNamespaceUseDefinition(GoToDefinitionRequest $request, CodeBase $code_base, Node $node): void
{
// TODO: Support GroupUse (See ScopeVisitor->visitGroupUse)
$targets = ScopeVisitor::aliasTargetMapFromUseNode($node);
if (count($targets) !== 1) {
- 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 canCastToUnionType
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToUnionType(
UnionType $target
): bool {
// Fast-track most common cases first
$type_set = $this->type_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 visitFor
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function visitFor(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 addEntriesForClass
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private static function addEntriesForClass(
CtagsEntrySet $entries,
CodeBase $code_base,
FullyQualifiedClassName $class_fqsen,
Clazz $class
- 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 addParametersAndUseVariablesToGraph
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private static function addParametersAndUseVariablesToGraph(
Node $node,
VariableGraph $graph,
VariableTrackingScope $scope
): array {
- 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 ensurePluginsExist
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function ensurePluginsExist(): void
{
if (!is_null($this->plugin_set)) {
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 analyzeParameterStrict
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeParameterStrict(CodeBase $code_base, Context $context, FunctionInterface $method, $argument_node, UnionType $argument_type, Variable $alternate_parameter, UnionType $parameter_type, int $lineno, int $i): void
{
if ($alternate_parameter instanceof Parameter && $alternate_parameter->isPassByReference() && $alternate_parameter->getReferenceType() === Parameter::REFERENCE_WRITE_ONLY) {
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 checkComplexIsset
has a Cognitive Complexity of 24 (exceeds 5 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;
- 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 warnNoopNew
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function warnNoopNew(
Node $node,
array $class_list
): void {
$has_constructor_or_destructor = \count($class_list) === 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 analyzePluginSuppressionsForFile
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function analyzePluginSuppressionsForFile(CodeBase $code_base, SuppressionCapability $plugin, string $relative_file_path): void
{
$absolute_file_path = Config::projectPath($relative_file_path);
$plugin_class = \get_class($plugin);
$name_pos = \strrpos($plugin_class, '\\');
- 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 visitSwitchList
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function visitSwitchList(Node $node): void
{
$children = $node->children;
if (count($children) <= 1) {
// This plugin will never emit errors if there are 0 or 1 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
Function warnAboutTransientSleepProperties
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function warnAboutTransientSleepProperties(array $sleep_properties): void
{
if (count($sleep_properties) === 0) {
// Give up, failed to extract property names
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
Method fromFullyQualifiedStringInner
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function fromFullyQualifiedStringInner(
string $fully_qualified_string
): Type {
if ($fully_qualified_string === '') {
throw new InvalidArgumentException("Type cannot be empty");
Method methodFQSENListFromParts
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function methodFQSENListFromParts($class_or_expr, $method_name): array
{
$code_base = $this->code_base;
$context = $this->context;
Method visitAssign
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitAssign(Node $node): void
{
$var = $node->children['var'];
if (!$var instanceof Node) {
return;
File phan_repl_helpers.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use Phan\CLI;