Showing 3,272 of 4,939 total issues
Function parseMultiPartRegularString
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function parseMultiPartRegularString(PhpParser\Node\StringLiteral $n, array $children): ast\Node
{
$inner_node_parts = [];
$start_quote_text = static::tokenToString($n->startQuote);
$end_quote_text = $n->endQuote->getText(self::$file_contents);
- 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 phpParserVisibilityToAstVisibility
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function phpParserVisibilityToAstVisibility(array $visibility, bool $automatically_add_public = true): int
{
$ast_visibility = 0;
foreach ($visibility as $token) {
switch ($token->kind) {
- 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 visitClassName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassName(Node $node): UnionType
{
$class_node = $node->children['class'];
try {
$class_list = (new ContextNode(
- 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 parseFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function parseFile(CodeBase $code_base, string $file_path, bool $suppress_parse_errors = false, string $override_contents = null, bool $is_php_internal_stub = false, ?Request $request = null): Context
{
$original_file_path = $file_path;
$code_base->setCurrentParsedFile($file_path);
if ($is_php_internal_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
Function getParametersCountsFromPhan
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getParametersCountsFromPhan(array $fields): array
{
$num_required = 0;
unset($fields[0]);
$num_optional = count($fields);
- 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 visitMethod
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitMethod(Node $node): void
{
$stmts_node = $node->children['stmts'] ?? null;
if (!$stmts_node || $stmts_node->children) {
- 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 containsFFICDataType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function containsFFICDataType(UnionType $union_type): int
{
foreach ($union_type->getTypeSet() as $type) {
if (strcasecmp('\FFI', $type->getNamespace()) !== 0) {
continue;
- 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 visitIf
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function visitIf(Node $node): void
{
if (count($node->children) <= 1) {
// There can't be any duplicates.
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
Method __clone
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __clone()
{
$this->fqsen_class_map =
$this->fqsen_class_map->deepCopyValues();
Method generateDefaultNodeRepresentation
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateDefaultNodeRepresentation(bool $is_internal = true): string
{
if (is_string($this->default_value_representation)) {
return $this->default_value_representation;
}
Method getGenericConstructorBuilder
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGenericConstructorBuilder(CodeBase $code_base): array
{
return $this->memoize(
'template_type_resolvers',
/**
Method canCastToNonNullableType
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
if (!$this->element_type->canCastToType($type->element_type)) {
Method canCastToNonNullableTypeWithoutConfig
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
if (!$this->element_type->canCastToTypeWithoutConfig($type->element_type)) {
Method combineArrayShapeTypes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function combineArrayShapeTypes(array $types, bool $add_mixed): ArrayShapeType
{
$is_nullable = false;
$field_types_list = [];
$common_field_types = [];
Method canCastTraversableToIterable
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function canCastTraversableToIterable(GenericIterableType $type): bool
{
$template_types = $this->template_parameter_type_list;
$count = count($template_types);
$name = $this->name;
Method suggestSimilarProperty
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function suggestSimilarProperty(CodeBase $code_base, Context $context, Clazz $class, string $wanted_property_name, bool $is_static): ?Suggestion
{
if (Config::getValue('disable_suggestions')) {
return null;
}
Method sanityCheckErrorList
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function sanityCheckErrorList(array $error_list): void
{
$error_map = [];
$unique_type_id_set = [];
foreach ($error_list as $error) {
Method generateSuppressIssueSummary
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateSuppressIssueSummary(string $baseline_summary_type): string
{
if ($baseline_summary_type === 'none') {
return '';
}
Method checkImpossibleComparison
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkImpossibleComparison(Node $node, bool $strict): void
{
$left = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $node->children['left']);
if (!$left->hasRealTypeSet()) {
return;
Method withoutCaughtUnionTypes
has 31 lines of code (exceeds 25 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;