Showing 3,272 of 4,939 total issues
Method visitBinaryAdd
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitBinaryAdd(Node $node): UnionType
{
static $int_or_float_or_array;
static $probably_int_type;
static $probably_array_type;
Method analyzePassByReferenceArgument
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzePassByReferenceArgument(
CodeBase $code_base,
Context $context,
Node $argument,
array $argument_list,
Method updateParameterTypeByArgument
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateParameterTypeByArgument(
FunctionInterface $method,
Parameter $parameter,
$argument,
array $argument_types,
File AssignOperatorFlagVisitor.php
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
Consider simplifying this complex logical expression. Open
if (!$this->comment_flags &&
!$this->return_comment &&
!$this->parameter_list &&
!$this->variable_list &&
!$this->template_type_list &&
TypedElement
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class TypedElement implements TypedElementInterface
{
/**
* @var string
* The name of the typed structural element
NullType
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
final class NullType extends ScalarType implements LiteralTypeInterface
{
/** @phan-override */
public const NAME = 'null';
Issue
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Issue
{
// phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase
// this is deliberate for issue names
// Issue::CATEGORY_SYNTAX
Method shouldWarnAboutImpossibleArrayKeyExists
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function shouldWarnAboutImpossibleArrayKeyExists(CodeBase $code_base, Context $context, array $args, ?UnionType $key_type = null, ?UnionType $array_type = null): bool
{
$array_type = $array_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
if (!$array_type->hasRealTypeSet()) {
return false;
File RedundantConditionCallPlugin.php
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
File LiteralStringType.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
Method getAnalyzeFunctionCallClosures
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
{
/**
* Analyzes a printf-like function with a format directive in the first position.
* @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
Method analyzeNode
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeNode(Node $stmts): array
{
$kind = $stmts->kind;
switch ($kind) {
// Nodes that create new scopes
Method visitReturn
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitReturn(Node $node): Context
{
$context = $this->context;
// Make sure we're actually returning from a method.
if (!$context->isInFunctionLikeScope()) {
Function addGlobalConstantsByNames
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function addGlobalConstantsByNames(array $const_name_list): void
{
$included_extension_subset = self::getIncludedExtensionSubset();
if (is_array($included_extension_subset)) {
$excluded_constant_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 magicMethodFromCommentLine
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function magicMethodFromCommentLine(
string $line,
int $comment_line_offset
): ?Method {
// https://phpdoc.org/docs/latest/references/phpdoc/tags/method.html
- 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 fromNode
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function fromNode(
Context $context,
CodeBase $code_base,
Node $node,
FullyQualifiedFunctionName $fqsen
- 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 asNormalizedTypeSetInner
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static function asNormalizedTypeSetInner(array $type_set): array
{
if (\count($type_set) <= 1) {
return $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 asClassList
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function asClassList(
CodeBase $code_base,
Context $context
): Generator {
// Iterate over each viable class type to see if any
- 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 canCastTraversableToIterable
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function canCastTraversableToIterable(GenericIterableType $type): bool
{
$template_types = $this->template_parameter_type_list;
$count = count($template_types);
$name = $this->name;
- 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"