Showing 4,939 of 4,939 total issues
Function fromStringInContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function fromStringInContext(
string $fqsen_string,
Context $context
) {
$parts = \explode('::', $fqsen_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
Function getFunctionLikeInScope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getFunctionLikeInScope(
CodeBase $code_base
): FunctionInterface {
$fqsen = $this->getFunctionLikeFQSEN();
- 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 canCastToNonNullableTypeWithoutConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type instanceof ScalarType) {
switch ($type::NAME) {
case 'int':
- 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 fromStringInContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function fromStringInContext(
string $fqsen_string,
Context $context
) {
// Check to see if we're fully qualified
- 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 6 (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 canCastToNonNullableTypeWithoutConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type instanceof ScalarType) {
switch ($type::NAME) {
case 'int':
- 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 __toString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __toString(): string
{
$parts = [];
foreach ($this->field_types as $key => $value) {
if (\is_string($key)) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
protected function isSubtypeOfNonNullableType(Type $type): bool
{
if ($type instanceof ScalarType) {
if ($type instanceof IntType) {
if ($type instanceof LiteralIntType) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
protected function isSubtypeOfNonNullableType(Type $type): bool
{
if ($type instanceof ScalarType) {
if ($type::NAME === 'float') {
if ($type instanceof LiteralFloatType) {
- 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 isExclusivelyNarrowedFormOf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isExclusivelyNarrowedFormOf(CodeBase $code_base, UnionType $other): bool
{
if ($other->isEmpty()) {
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 toNumericTypes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function toNumericTypes(array $type_set): array
{
$result = [];
foreach ($type_set as $type) {
if ($type->isPossiblyNumeric()) {
- 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 hasPhpdocOrRealTypeMatchingCallback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function hasPhpdocOrRealTypeMatchingCallback(Closure $matcher_callback): bool
{
foreach ($this->type_set as $type) {
if ($matcher_callback($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 getTemplateTypeExtractorClosure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
{
$template_union_type = $this->template_parameter_type_list[0] ?? null;
if (!$template_union_type) {
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 normalizeMultiTypes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function normalizeMultiTypes(array $types): array
{
foreach ($types as $i => $type) {
if ($type instanceof MultiType) {
foreach ($type->asIndividualTypeInstances() as $new_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 canCastToNonNullableType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
if ($type->isCallable()) {
if ($type instanceof FunctionLikeDeclarationType) {
// Check if the function declaration is known and available. It's not available for the generic \Closure.
- 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 canCastToNonNullableTypeWithoutConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type->isCallable()) {
if ($type instanceof FunctionLikeDeclarationType) {
// Check if the function declaration is known and available. It's not available for the generic \Closure.
- 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 getUniqueTypes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getUniqueTypes(array $type_list): array
{
$new_type_list = [];
if (\count($type_list) >= 8) {
// This approach is faster, but only when there are 8 or more types (tested in php 7.3)
- 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 canTemplateTypesCast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function canTemplateTypesCast(array $other_template_parameter_type_list, CodeBase $code_base): bool
{
foreach ($this->template_parameter_type_list as $i => $param) {
$other_param = $other_template_parameter_type_list[$i] ?? null;
if ($other_param !== 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 visitStmtList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function visitStmtList(Node $node): Context
{
$context = $this->context;
$plugin_set = ConfigPluginSet::instance();
$plugin_set->preAnalyzeNode(
- 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 warnAboutNonTraversableType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function warnAboutNonTraversableType(Node $node, Type $type): void
{
$fqsen = FullyQualifiedClassName::fromType($type);
if (!$this->code_base->hasClassWithFQSEN($fqsen)) {
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"