Showing 3,272 of 4,939 total issues
Function finalizeProcess
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function finalizeProcess(CodeBase $code_base): void
{
if (empty($this->elements)) {
\fwrite(\STDERR, "Nothing to analyze - please run pdep from your top-level project directory" . \PHP_EOL);
exit(\EXIT_FAILURE);
- 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 visitVar
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function visitVar(Node $node): Context
{
try {
$variable_name = (new ContextNode(
$this->code_base,
- 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 visitStmtList
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function visitStmtList(Node $node): void
{
$child_nodes = $node->children;
$last_node_index = count($child_nodes) - 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 checkCall
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
private function checkCall(FunctionInterface $function, array $args, Node $node): void
{
$arg_names = [];
foreach ($args as $i => $arg_node) {
$name = self::extractName($arg_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 isRedundantFunctionComment
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
private static function isRedundantFunctionComment(FunctionInterface $method, string $doc_comment): bool
{
$lines = explode("\n", $doc_comment);
foreach ($lines as $line) {
$line = trim($line, " \r\n\t*/");
- 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 hasInternalFunctionWithFQSEN
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private function hasInternalFunctionWithFQSEN(
FullyQualifiedFunctionName $fqsen
): bool {
$canonical_fqsen = $fqsen->withAlternateId(0);
$found = isset($this->internal_function_fqsen_set[$canonical_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 checkInvalidArrayShapeCombination
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public static function checkInvalidArrayShapeCombination(
CodeBase $code_base,
Context $context,
Node $node,
UnionType $left,
- 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 createClosureForMethod
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createClosureForMethod(CodeBase $code_base, Method $method, string $name): ?Closure
{
// TODO: Add a helper method which will convert a doc comment and a stub php function source code to a closure for a param index (or indices)
switch (\strtolower($name)) {
case 'asserttrue':
File ReferenceCountsAnalyzer.php
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Analysis;
Method maybeParsePhanCustomAnnotation
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function maybeParsePhanCustomAnnotation(int $i, string $line, string $type, string $case_sensitive_type): void
{
switch ($type) {
case 'phan-forbid-undeclared-magic-properties':
if ($this->checkCompatible('@phan-forbid-undeclared-magic-properties', [Comment::ON_CLASS], $i)) {
Method analyzeRealSignatureCompatibility
has 134 lines of code (exceeds 25 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) {
Parameter
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class Parameter extends Variable
{
public const REFERENCE_DEFAULT = 1;
public const REFERENCE_READ_WRITE = 2;
public const REFERENCE_WRITE_ONLY = 3;
Method getPropertyByNameInContext
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPropertyByNameInContext(
CodeBase $code_base,
string $name,
Context $context,
bool $is_static,
Function encodeValue
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public static function encodeValue($value, int $max_depth = 2): string
{
if (is_object($value)) {
if ($value instanceof IssueInstance) {
return "IssueInstance($value)";
- 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 extractDescriptionFromDocComment
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public static function extractDescriptionFromDocComment(
AddressableElementInterface $element,
CodeBase $code_base = null
): ?string {
$extracted_doc_comment = self::extractDescriptionFromDocCommentRaw($element);
- 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 combineScopeList
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function combineScopeList(array $scope_list): Context
{
if (\count($scope_list) < 2) {
throw new AssertionError("Expected at least two child contexts in " . __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
Function resolveArrayShapeElementTypes
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private function resolveArrayShapeElementTypes(Node $node, UnionType $union_type): ?UnionType
{
$dim_node = $node->children['dim'];
$dim_value = $dim_node instanceof Node ? (new ContextNode($this->code_base, $this->context, $dim_node))->getEquivalentPHPScalarValue() : $dim_node;
// TODO: detect and warn about 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
Function visitStmtList
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function visitStmtList(Node $node): void
{
if (count($node->children) <= 1) {
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
File PropertyMap.php
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Internal;
Function renderLongProgress
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private static function renderLongProgress(string $msg, float $p, float $memory, ?int $offset, ?int $count): string
{
$buf = '';
if ($msg !== self::$current_progress_state_long_progress) {
switch ($msg) {
- 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"