Showing 3,272 of 4,939 total issues
File Config.php
has 683 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan;
Function analyzeRealSignatureCompatibility
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeRealSignatureCompatibility(CodeBase $code_base, FunctionInterface $method, int $minimum_target_php_version): void
{
$php70_checks = $minimum_target_php_version < 70100;
foreach ($method->getRealParameterList() as $real_parameter) {
- 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 visitDim
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
public function visitDim(Node $node, bool $treat_undef_as_nullable = false): UnionType
{
$union_type = self::unionTypeFromNode(
$this->code_base,
$this->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 FunctionLikeDeclarationType.php
has 667 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
Function getProperty
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
public function getProperty(
bool $is_static,
bool $is_known_assignment = false
): Property {
$node = $this->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
Method getReturnTypeOverridesStatic
has 297 lines of code (exceeds 25 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');
Function analyzeReturnTypesInner
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeReturnTypesInner(CodeBase $code_base): void
{
if ($this->isPHPInternal()) {
// nothing to do, no known Node
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 analyzeParameterTypesInner
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeParameterTypesInner(
CodeBase $code_base,
FunctionInterface $method
): void {
if (Config::getValue('check_docblock_signature_param_type_match')) {
- 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 Method.php
has 648 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
Function addProperty
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
{
$variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
// If something goes wrong will getting the type of
- 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
FlagVisitorImplementation
has 74 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class FlagVisitorImplementation implements FlagVisitor
{
/**
* This is called to analyze nodes in FlagVisitorImplementation subclasses
Function warnAboutVariableGraph
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
private function warnAboutVariableGraph(
Node $method_node,
VariableGraph $graph,
array $issue_overrides_for_definition_ids
): void {
- 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 loadMethodPlugins
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
public static function loadMethodPlugins(CodeBase $code_base): void
{
$plugin_set = ConfigPluginSet::instance();
$return_type_overrides = $plugin_set->getReturnTypeOverrides($code_base);
$return_type_override_fqsen_strings = [];
- 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 analyzeParameterListForCallback
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeParameterListForCallback(
CodeBase $code_base,
FunctionInterface $method,
array $arg_nodes,
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
Function resolveDocCommentForClosure
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
private static function resolveDocCommentForClosure(PhpParser\Node\Expression $node): ?string
{
$doc_comment = $node->getDocCommentText();
if (\Phan\Library\StringUtil::isNonZeroLengthString($doc_comment)) {
return $doc_comment;
- 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 LanguageServer.php
has 595 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\LanguageServer;
Function fromStringInContext
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
public static function fromStringInContext(
string $string,
Context $context,
int $source,
CodeBase $code_base = 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
InferPureVisitor
has 69 functions (exceeds 20 allowed). Consider refactoring. Open
class InferPureVisitor extends AnalysisVisitor
{
/** @var string the function fqsen being visited */
protected $function_fqsen_label;
File AssignOperatorAnalysisVisitor.php
has 583 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
File ASTSimplifier.php
has 583 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\AST;