Showing 3,272 of 4,939 total issues
Function methodFQSENListFromObjectAndMethodName
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
{
$code_base = $this->code_base;
$context = $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
Method visitIf
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitIf(Node $node): Context
{
$context = $this->context->withLineNumberStart(
$node->lineno
);
Method visitBinaryAdd
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitBinaryAdd(Node $node): Context
{
return $this->updateTargetWithType($node, function (UnionType $left) use ($node): UnionType {
$code_base = $this->code_base;
$context = $this->context;
Method visitStaticCall
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitStaticCall(Node $node): Context
{
// Get the name of the method being called
$method_name = $node->children['method'];
Method visitArray
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitArray(Node $node): UnionType
{
$children = $node->children;
if (\count($children) > 0) {
$key_set = $this->getEquivalentArraySet($node);
Method loadMethodPlugins
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 = [];
Method analyzeReturnValue
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeReturnValue($expr_node, int $lineno, array &$sleep_properties): void
{
$context = clone($this->context)->withLineNumberStart($lineno);
if (!($expr_node instanceof Node)) {
$this->emitPluginIssue(
Method checkUselessScalarComparison
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkUselessScalarComparison(
Node $node,
UnionType $left,
UnionType $right,
$left_node,
Method analyzeParameter
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 =
File FlagVisitorImplementation.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace Phan\AST\Visitor;
File Element.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace Phan\AST\Visitor;
AssignOperatorAnalysisVisitor
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class AssignOperatorAnalysisVisitor extends FlagVisitorImplementation
{
/**
* @var CodeBase The code base within which we're operating
ASTSimplifier
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ASTSimplifier
{
public function __construct()
{
}
Method addParamToScopeOfFunctionOrMethod
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function addParamToScopeOfFunctionOrMethod(
Context $context,
CodeBase $code_base,
FunctionInterface $function,
Comment $comment,
Method analyzeShapedArrayAssignment
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeShapedArrayAssignment(Node $node): void
{
// Figure out the type of elements in the list
$fallback_element_type = null;
/** @suppress PhanAccessMethodInternal */
Method analyzeElementReferenceCounts
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function analyzeElementReferenceCounts(
CodeBase $code_base,
AddressableElement $element,
string $issue_type
): void {
File Property.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
Method addMethod
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addMethod(
CodeBase $code_base,
Method $method,
Option $type_option
): void {
Method visitDim
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitDim(Node $node): Context
{
$expr_node = $node->children['expr'];
if (!($expr_node instanceof Node)) {
$this->emitIssue(
Function parameterFromCommentLine
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
private function parameterFromCommentLine(
string $line,
bool $is_var,
int $i
): 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"