Showing 3,272 of 4,939 total issues
IncompatibleSignatureDetectorBase
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class IncompatibleSignatureDetectorBase
{
use Memoize;
const FUNCTIONLIKE_BLACKLIST = '@' .
Method visitDim
has 173 lines of code (exceeds 25 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,
Function merge
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
public static function merge(array $union_types, bool $normalize_array_shapes = true): UnionType
{
$n = \count($union_types);
if ($n < 2) {
return \reset($union_types) ?: UnionType::$empty_instance;
- 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 analyzePropertyTypes
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzePropertyTypes(CodeBase $code_base, Clazz $clazz): void
{
foreach ($clazz->getPropertyMap($code_base) as $property) {
// This phase is done before the analysis phase, so there aren't any dynamic properties to filter out.
- 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 Initializer.php
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Config;
ConfigPluginSet
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
final class ConfigPluginSet extends PluginV3 implements
AfterAnalyzeFileCapability,
AnalyzeClassCapability,
AnalyzeFunctionCapability,
AnalyzeFunctionCallCapability,
Function analyzeComposition
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public static function analyzeComposition(
CodeBase $code_base,
Clazz $class
): void {
// Get the list of all inherited classes.
- 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 Parser.php
has 444 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\AST;
Method addProperty
has 165 lines of code (exceeds 25 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
File IncompatibleSignatureDetectorBase.php
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use Phan\CodeBase;
Function combineArrayTypeListsOverriding
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
private static function combineArrayTypeListsOverriding(array $left_types, array $right_types, bool $is_assignment, bool $is_real): array
{
if ($is_real && !$right_types) {
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 visitArray
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public function visitArray(Node $node): UnionType
{
$children = $node->children;
if (\count($children) > 0) {
$key_set = $this->getEquivalentArraySet($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 check_fields
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
function check_fields(string $function_name, array $fields, array $signatures): void
{
$return_type = $fields[0]; // TODO: Check type
if (!is_string($return_type)) {
throw new InvalidArgumentException("Invalid return type: " . json_encode($return_type));
Method analyzeOverrideRealSignature
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeOverrideRealSignature(
CodeBase $code_base,
Method $method,
Clazz $class,
Method $o_method,
ContextNode
has 47 functions (exceeds 20 allowed). Consider refactoring. Open
class ContextNode
{
/** @var CodeBase The code base within which we're operating */
private $code_base;
File KindVisitorImplementation.php
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\AST\Visitor;
Method fromReflectionClass
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromReflectionClass(
CodeBase $code_base,
ReflectionClass $class
): Clazz {
// Build a set of flags based on the constitution
Function getMethod
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function getMethod(
$method_name,
bool $is_static,
bool $is_direct = false,
bool $is_new_expression = 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 addParamToScopeOfFunctionOrMethod
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public static function addParamToScopeOfFunctionOrMethod(
Context $context,
CodeBase $code_base,
FunctionInterface $function,
Comment $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
Function analyzeShapedArrayAssignment
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeShapedArrayAssignment(Node $node): void
{
// Figure out the type of elements in the list
$fallback_element_type = null;
/** @suppress PhanAccessMethodInternal */
- 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"