Showing 3,272 of 4,939 total issues
Function getEquivalentPHPValueForNode
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function getEquivalentPHPValueForNode($node, int $flags)
{
if (!($node instanceof Node)) {
return $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 ensurePluginsExist
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ensurePluginsExist(): void
{
if (!is_null($this->plugin_set)) {
return;
}
Method visitVar
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitVar(Node $node): Context
{
try {
$variable_name = (new ContextNode(
$this->code_base,
Method getReturnTypeOverridesStatic
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getReturnTypeOverridesStatic(): array
{
/**
* @param list<Node|int|string|float> $args
*/
Method getEquivalentPHPValueForNode
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEquivalentPHPValueForNode($node, int $flags)
{
if (!($node instanceof Node)) {
return $node;
}
File DefinitionResolver.php
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\LanguageServer;
Property
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Property extends ClassElement
{
use ElementFutureUnionType;
use ClosedScopeElement;
Config
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Config
{
/**
* The version of the AST (defined in php-ast) that we're using.
* @see https://github.com/nikic/php-ast#ast-versioning
File MarkupDescription.php
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
File IncompatibleStubsSignatureDetector.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use Phan\Analysis;
Function checkAllArgsUsed
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function checkAllArgsUsed(array $opts, array &$argv): void
{
$pruneargv = [];
foreach ($opts as $opt => $value) {
foreach ($argv as $key => $chunk) {
- 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 readMessages
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function readMessages(): int
{
$emitted_messages = 0;
while (($c = \fgetc($this->input)) !== false && $c !== '') {
$this->buffer .= $c;
- 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 getShortRepresentationForIssue
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function getShortRepresentationForIssue(bool $is_internal = false): string
{
$string = '';
$union_type_string = $this->getUnionTypeRepresentationForIssue();
- 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 iterableKeyUnionType
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function iterableKeyUnionType(CodeBase $code_base): UnionType
{
// This is frequently called, and has been optimized
$new_type_builder = new UnionTypeBuilder();
foreach ($this->type_set as $type) {
- 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 withFlattenedTopLevelArrayShapeTypeInstancesForSet
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function withFlattenedTopLevelArrayShapeTypeInstancesForSet(array $type_set): array
{
$result = [];
$has_other_array_type = false;
$empty_array_shape_type = 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 applyNumericOperationToList
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static function applyNumericOperationToList(array $type_set, Closure $operation): array
{
$added_fallbacks = false;
$result = [];
foreach ($type_set as $type) {
- 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 iterableKeyUnionType
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function iterableKeyUnionType(CodeBase $code_base): ?UnionType
{
if ($this->namespace === '\\') {
$name = strtolower($this->name);
if ($name === 'traversable' || $name === 'iterator') {
- 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 iterableValueUnionType
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function iterableValueUnionType(CodeBase $code_base): ?UnionType
{
if ($this->namespace === '\\') {
$name = strtolower($this->name);
if ($name === 'traversable' || $name === 'iterator') {
- 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 visitMatchArmList
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function visitMatchArmList(Node $node): Context
{
// Make a copy of the internal context so that we don't
// leak any changes within the closed context to the
// outer scope
- 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 withoutCaughtUnionTypes
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function withoutCaughtUnionTypes(UnionType $union_type, bool $is_raw_throw): UnionType
{
if ($union_type->isEmpty()) {
if (!$is_raw_throw) {
return $union_type;
- 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"