Showing 4,939 of 4,939 total issues
Function withTemplateParameterTypeMap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function withTemplateParameterTypeMap(
array $template_parameter_type_map
): UnionType {
$has_template = false;
$concrete_type_list = [];
- 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 toNonTruthyTypeSet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function toNonTruthyTypeSet(array $type_set): array
{
$result = [];
foreach ($type_set as $type) {
if (!$type->isPossiblyTruthy()) {
- 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 nonTrueClone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function nonTrueClone(): UnionType
{
$builder = new UnionTypeBuilder();
$did_change = false;
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 computeRealTypeSetForArrayShapeTypeWithField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function computeRealTypeSetForArrayShapeTypeWithField(UnionType $left, $field_dim_value, UnionType $field_type): array
{
$has_non_array_shape = false;
foreach ($left->getRealTypeSet() as $type) {
if (!$type instanceof ArrayType || $type->isNullable()) {
- 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 replaceWithTemplateTypes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function replaceWithTemplateTypes(UnionType $template_union_type): UnionType
{
if ($template_union_type->isEmpty()) {
return $this;
}
- 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 isSubtypeOfNonNullableType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function isSubtypeOfNonNullableType(Type $type): bool
{
if ($type instanceof ScalarType) {
if ($type instanceof StringType) {
if ($type instanceof LiteralStringType) {
- 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 getDifferingVariables
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getDifferingVariables(array $scope_list): array
{
if (count($scope_list) < 2) {
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 isExclusivelyNarrowedFormOrEquivalentTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isExclusivelyNarrowedFormOrEquivalentTo(
UnionType $union_type,
Context $context,
CodeBase $code_base
): bool {
- 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 getKnownClasses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function getKnownClasses(): array
{
static $known_classes = null;
if (!is_array($known_classes)) {
$known_classes = MarkupDescription::loadClassDescriptionMap();
- 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 preAnalyzeIfElemCondition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function preAnalyzeIfElemCondition(Node $if_elem_node, Context $fallthrough_context): array
{
$condition_node = $if_elem_node->children['cond'];
if ($condition_node instanceof Node) {
if ($condition_node->kind === ast\AST_BINARY_OP) {
- 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 suggestSimilarClassConstant
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function suggestSimilarClassConstant(CodeBase $code_base, Context $context, FullyQualifiedClassConstantName $class_constant_fqsen): ?Suggestion
{
if (Config::getValue('disable_suggestions')) {
return 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 handleScalarStmt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function handleScalarStmt(Node $node, Context $context, $child_node): void
{
if (\is_string($child_node)) {
$consumed = false;
if (\strpos($child_node, '@phan-') !== 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 visitTry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitTry(Node $node): Context
{
$context = $this->context->withLineNumberStart(
$node->lineno
);
- 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 getNextTypeId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function getNextTypeId(array $issue_list, int $invalid_type_id): int
{
for ($id = $invalid_type_id + 1; true; $id++) {
foreach ($issue_list as $error) {
if ($error->getTypeId() === $id) {
- 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 generateClosureForFunctionInterface
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function generateClosureForFunctionInterface(FunctionInterface $function): ?Closure
{
$callable_params = [];
$class_params = [];
foreach ($function->getParameterList() as $i => $param) {
- 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 isVoidFunction
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function isVoidFunction(FunctionInterface $function): bool
{
if ($function->getUnionType()->isNull()) {
return true;
}
- 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 getAbsolutePath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getAbsolutePath(Node $node, string $relative_path): string
{
if (Paths::isAbsolutePath($relative_path)) {
return $relative_path;
}
- 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 computeClosestTargetPHPVersionId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function computeClosestTargetPHPVersionId(string $version): int
{
if (\version_compare($version, '6.0') < 0) {
return 50600;
} elseif (\version_compare($version, '7.1') < 0) {
- 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 isCastableButNotSubtype
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function isCastableButNotSubtype(UnionType $actual_type, Type $inner_type): bool
{
if ($inner_type instanceof ObjectType) {
foreach ($actual_type->getTypeSet() as $type) {
if ($type->isPossiblyObject() && !$type->isObjectWithKnownFQSEN()) {
- 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 analyzeArrayAssignmentTarget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeArrayAssignmentTarget(Node $node, $const_expr): VariableTrackingScope
{
foreach ($node->children as $elem_node) {
if (!($elem_node instanceof Node)) {
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"