Showing 3,272 of 4,939 total issues
File GenericArrayType.php
has 582 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
Function analyzeOverrideSignatureForOverriddenMethod
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeOverrideSignatureForOverriddenMethod(
CodeBase $code_base,
Method $method,
Clazz $class,
Method $o_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
File ArrayReturnTypeOverridePlugin.php
has 573 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
File PrintfCheckerPlugin.php
has 573 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\PrintfCheckerPlugin;
File IssueFixSuggester.php
has 571 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan;
File DependencyGraphPlugin.php
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
Method getAnalyzeFunctionCallClosuresStatic
has 242 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param Closure(UnionType):int $checker returns _IS_IMPOSSIBLE/_IS_REDUNDANT/_IS_REASONABLE_CONDITION
* @param string $expected_type
File Context.php
has 569 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language;
Function analyzeParameter
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzeParameter(CodeBase $code_base, Context $context, FunctionInterface $method, UnionType $argument_type, int $lineno, int $i, $argument_node, ?Node $node): void
{
// Expand it to include all parent types up the chain
try {
$argument_type_expanded_resolved =
- 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 Parameter.php
has 555 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
File PreOrderAnalysisVisitor.php
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
Function getReturnTypeOverridesStatic
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
public static function getReturnTypeOverridesStatic(CodeBase $code_base): array
{
$string_union_type = StringType::instance(false)->asPHPDocUnionType();
$string_union_type_real = StringType::instance(false)->asRealUnionType();
$string_union_type_with_false_in_real = UnionType::fromFullyQualifiedPHPDocAndRealString('string', 'string|false');
- 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 shouldWarnAboutImpossibleArrayKeyExists
has a Cognitive Complexity of 57 (exceeds 5 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;
- 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
CLI
has 61 functions (exceeds 20 allowed). Consider refactoring. Open
class CLI
{
/**
* This should be updated to x.y.z-dev after every release, and x.y.z before a release.
*/
Method fromStringInContext
has 218 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromStringInContext(
string $string,
Context $context,
int $source,
CodeBase $code_base = null
File Phan.php
has 528 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan;
Function analyzeClassConstantTypes
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzeClassConstantTypes(CodeBase $code_base, Clazz $clazz): void
{
foreach ($clazz->getConstantMap($code_base) as $constant) {
// This phase is done before the analysis phase, so there aren't any dynamic properties to filter out.
- 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 RedundantConditionVisitor.php
has 524 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
File PropertyDocumentationMap.php
has 522 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php // phpcs:ignoreFile
namespace Phan\Language\Internal;
/**
* This contains descriptions used by Phan for hover text of internal properties in the language server mode.
Method getProperty
has 213 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProperty(
bool $is_static,
bool $is_known_assignment = false
): Property {
$node = $this->node;