Showing 3,272 of 4,939 total issues
Function createPhanSettingsForComposerSettings
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function createPhanSettingsForComposerSettings(array $composer_settings, ?string $vendor_path, array $opts): InitializedSettings
{
$level = $opts['init-level'] ?? 3;
$level = self::LEVEL_MAP[\strtolower((string)$level)] ?? $level;
if (\filter_var($level, FILTER_VALIDATE_INT) === 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 checkComplexIsset
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private function checkComplexIsset(Node $node): Context
{
// Loop to support getting the var name in is_array($x['field'][0])
$has_prop_access = false;
$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
Function analyzeGenericArrayAssignment
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeGenericArrayAssignment(Node $node): void
{
// Figure out the type of elements in the list
$right_type = $this->right_type;
if ($right_type->isEmpty()) {
- 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 findNodeAtOffsetRecursive
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private static function findNodeAtOffsetRecursive(\Microsoft\PhpParser\Node $parser_node, int $offset)
{
foreach ($parser_node->getChildNodesAndTokens() as $key => $node_or_token) {
if ($node_or_token instanceof Token) {
// fprintf(
- 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 analyzeReturnTypesInner
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeReturnTypesInner(CodeBase $code_base): void
{
if ($this->isPHPInternal()) {
// nothing to do, no known Node
return;
Method warnInvalidArgumentType
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function warnInvalidArgumentType(
CodeBase $code_base,
Context $context,
FunctionInterface $method,
Parameter $alternate_parameter,
Method visitSwitchList
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitSwitchList(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
File Analysis.php
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan;
Method createNegationCallbackMap
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function createNegationCallbackMap(): array
{
/** @param list<Node|mixed> $unused_args */
$remove_null_cb = static function (CodeBase $unused_code_base, Context $unused_context, Variable $variable, array $unused_args): void {
$variable->setUnionType($variable->getUnionType()->nonNullableClone());
Function fromReflectionClass
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function fromReflectionClass(
CodeBase $code_base,
ReflectionClass $class
): Clazz {
// Build a set of flags based on the constitution
- 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 updateSignature
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function updateSignature(string $function_like_name, array $arguments_from_phan): array
{
$return_type = $arguments_from_phan[0];
$arguments_from_external_stub = $this->parseFunctionLikeSignature($function_like_name);
if (is_null($arguments_from_external_stub)) {
- 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 make
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function make(
string $namespace,
string $type_name,
array $template_parameter_type_list,
bool $is_nullable,
Method getAnalyzeFunctionCallClosuresStatic
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
$make_order_warner = static function (int $expected_const_pos, int $expected_variable_pos): Closure {
$expected_arg_count = 1 + (int)\max($expected_const_pos, $expected_variable_pos);
/**
Function getPropertyByNameInContext
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function getPropertyByNameInContext(
CodeBase $code_base,
string $name,
Context $context,
bool $is_static,
- 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 findAlternateReferencedElementDeclaration
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public static function findAlternateReferencedElementDeclaration(
CodeBase $code_base,
AddressableElement $element
): ?AddressableElement {
$old_fqsen = $element->getFQSEN();
- 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 analyzePropAssignment
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function analyzePropAssignment(Clazz $clazz, Property $property, Node $node): Context
{
if ($property->isReadOnly()) {
$this->analyzeAssignmentToReadOnlyProperty($property, $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 classTypesForNonName
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function classTypesForNonName(Node $node): UnionType
{
$node_type = UnionTypeVisitor::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
Method analyzeFunction
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function analyzeFunction(
CodeBase $code_base,
Func $function
): void {
// NOTE: Placeholders can be found in \Phan\Issue::uncolored_format_string_for_replace
File DependentReturnTypeOverridePlugin.php
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
Scope
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Scope
{
public const IN_FUNCTION_LIKE_SCOPE = 0x01;
// If this is set, and neither IN_TRAIT_SCOPE and IN_INTERFACE_SCOPE are set, this is
public const IN_CLASS_SCOPE = 0x02;