Showing 3,272 of 4,939 total issues
Method createPassByReferenceArgumentInCall
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createPassByReferenceArgumentInCall(FunctionInterface $method, Node $argument, Parameter $parameter, ?Parameter $real_parameter): void
{
if ($argument->kind === ast\AST_VAR) {
// We don't do anything with the new variable; just create it
// if it doesn't exist
Method visitStaticCall
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitStaticCall(Node $node): void
{
$method = $node->children['method'];
if (!\is_string($method)) {
throw new NodeException($node);
Method lookupClassOfCallableByName
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function lookupClassOfCallableByName(string $class_name): ?FullyQualifiedClassName
{
switch (\strtolower($class_name)) {
case 'self':
case 'static':
Method validateTranslations
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function validateTranslations(CodeBase $code_base, Context $context, string $fmt_str, array $types_of_arg): void
{
$translations = static::gettextForAllLocales($fmt_str);
foreach ($translations as $locale => $translated_fmt_str) {
// Skip untranslated or equal strings.
Method checkIsRedundantReturn
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function checkIsRedundantReturn(CodeBase $code_base, FunctionInterface $method, string $doc_comment): void
{
if (strpos($doc_comment, '@return') === false) {
return;
}
Function importAncestorClasses
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function importAncestorClasses(CodeBase $code_base): void
{
if (!$this->isFirstExecution(__METHOD__)) {
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 trimLeadingWhitespace
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function trimLeadingWhitespace(array $lines): array
{
if (count($lines) === 0) {
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 isAccessibleFromClass
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function isAccessibleFromClass(CodeBase $code_base, ?FullyQualifiedClassName $accessing_class_fqsen): bool
{
if ($this->isPublic()) {
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 make
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function make(
string $namespace,
string $name,
int $alternate_id = 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 combineArrayShapeTypes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function combineArrayShapeTypes(array $types, bool $add_mixed): ArrayShapeType
{
$is_nullable = false;
$field_types_list = [];
$common_field_types = [];
- 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 canCastToDeclaredType
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToDeclaredType(CodeBase $code_base, Context $context, Type $type): bool
{
if ($type instanceof ScalarType) {
switch ($type::NAME) {
case '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 checkUnreachableCatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function checkUnreachableCatch(array $catch_nodes, Context $context): void
{
if (count($catch_nodes) <= 1) {
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 normalizeScalarImplicitPartial
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function normalizeScalarImplicitPartial($value): array
{
if (!is_array($value)) {
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 warnAboutCouldBeConstant
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function warnAboutCouldBeConstant(VariableGraph $graph, string $variable_name, int $definition_id, $value_node): void
{
$issue_type = Issue::VariableDefinitionCouldBeConstant;
if ($value_node instanceof Node) {
if ($value_node->kind === ast\AST_ARRAY) {
- 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 visitFuncDecl
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function visitFuncDecl(Node $node): Context
{
$function_name = (string)$node->children['name'];
$code_base = $this->code_base;
$original_context = $this->context;
- 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 addDefaultPropertiesOfThisToContext
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function addDefaultPropertiesOfThisToContext(Clazz $class, Context $context): void
{
$property_types = [];
foreach ($class->getPropertyMap($this->code_base) as $property) {
if ($property->isDynamicOrFromPHPDoc()) {
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
public function visitMethod(Node $node): Context
{
$method_name = (string)$node->children['name'];
$code_base = $this->code_base;
$context = $this->context;
- 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 analyzeRemainingParametersForVariadic
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeRemainingParametersForVariadic(
CodeBase $code_base,
Context $context,
FunctionInterface $method,
int $start_index,
- 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 addConstant
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function addConstant(
CodeBase $code_base,
Context $context,
int $lineno,
string $name,
- 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 tryToAssignPHPDocTypeToParameter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static function tryToAssignPHPDocTypeToParameter(
CodeBase $code_base,
FunctionInterface $method,
int $i,
Parameter $parameter,
- 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"