Showing 3,272 of 4,939 total issues
Function inferNormalizedTypesOfDefault
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function inferNormalizedTypesOfDefault(UnionType $default_type): UnionType
{
$type_set = $default_type->getTypeSet();
if (\count($type_set) === 0) {
return $default_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
Method addParamToScopeOfFunctionOrMethod
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
CodeBase $code_base,
FunctionInterface $function,
Comment $comment,
int $parameter_offset,
Function fromFullyQualifiedString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function fromFullyQualifiedString(
string $fully_qualified_string
) {
$key = static::class . '|' . $fully_qualified_string;
- 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 fromElementTypes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
array $element_types,
bool $is_nullable,
int $key_type,
bool $always_has_elements = false,
bool $is_list = false,
Function canCastToNonNullableType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
// Scalars may be configured to always cast to each other.
// NOTE: This deliberately includes NullType, which doesn't satisfy `is_scalar()`
if ($type instanceof ScalarType) {
- 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 withNamespaceMap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function withNamespaceMap(
int $flags,
string $alias,
FullyQualifiedGlobalStructuralElement $target,
int $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 keyUnionTypeFromTypeSetStrict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function keyUnionTypeFromTypeSetStrict(array $type_set): int
{
$key_types = self::KEY_EMPTY;
foreach ($type_set as $type) {
if ($type instanceof GenericArrayType) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
array $types,
bool $is_nullable,
int $key_type,
bool $always_has_elements = false,
bool $is_list = false,
Function __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(FileRef $file_ref, array $params, UnionType $return_type, bool $returns_reference, bool $is_nullable)
{
parent::__construct('\\', static::NAME, [], $is_nullable);
$this->file_ref = FileRef::copyFileRef($file_ref);
$this->params = $params;
- 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 toNonNullableTypeList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function toNonNullableTypeList(array $type_list): array
{
$result = [];
foreach ($type_list as $type) {
if (!$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 filterTypesInBoolFamily
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function filterTypesInBoolFamily(array $type_list): array
{
$result = [];
foreach ($type_list as $type) {
if ($type->isInBoolFamily()) {
- 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 canAnyTypeWeakOverlapUnionType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function canAnyTypeWeakOverlapUnionType(UnionType $target): bool
{
foreach ($this->type_set as $type) {
foreach ($target->type_set as $other_type) {
if ($type->weaklyOverlaps($other_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 asMappedListUnionType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function asMappedListUnionType(Closure $closure): UnionType
{
// In php 7.3, this could be replaced with https://www.php.net/array_push
$new_type_set = [];
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 mergeUniqueTypes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function mergeUniqueTypes(array $type_list, array $other_type_list): array
{
if (\count($other_type_list) <= 4) {
// NOTE: implementing it this way takes advantage of copy-on-write for small arrays.
// If no new types were added, the original array $type_list will be reused.
- 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 instance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function instance(bool $is_nullable): Type
{
if ($is_nullable) {
static $nullable_instance = 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 toNonFalseyTypeSet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function toNonFalseyTypeSet(array $type_set): array
{
$result = [];
foreach ($type_set as $type) {
if (!$type->isPossiblyFalsey()) {
- 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 parseListTypeFromTemplateParameterList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function parseListTypeFromTemplateParameterList(
array $template_parameter_type_list,
bool $is_nullable,
bool $always_has_elements
): ArrayType {
- 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 stringFromReflectionType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function stringFromReflectionType(
?\ReflectionType $reflection_type
): string {
if (!$reflection_type) {
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 isSubtypeOf
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function isSubtypeOf(Type $type): bool
{
// Check to see if we have an exact object match
if ($this === $type) {
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 isEmptyIterable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function isEmptyIterable(UnionType $union_type): bool
{
$has_iterable_types = false;
foreach ($union_type->getRealTypeSet() as $type) {
if ($type->isPossiblyObject()) {
- 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"