Showing 4,939 of 4,939 total issues
Function analyzePropAssignmentTarget
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzePropAssignmentTarget(Node $node): VariableTrackingScope
{
// Treat $y in `$x->$y = $z;` as a usage of $y
$this->scope = $this->analyzeWhenValidNode($this->scope, $node->children['prop']);
$expr = $node->children['expr'];
- 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 normalizeDirectorySuppressions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function normalizeDirectorySuppressions(array $dir_suppressions): array
{
foreach ($dir_suppressions as $file_path => $rules) {
$new_file_path = self::normalizeDirectoryPathString($file_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 hasUnknownTypeLoopNodeKinds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function hasUnknownTypeLoopNodeKinds(Node $node): bool
{
switch ($node->kind) {
case ast\AST_CLOSURE:
case ast\AST_ARROW_FUNC:
- 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 getAnalyzeFunctionCallClosuresStatic
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param Closure(UnionType):int $checker returns _IS_IMPOSSIBLE/_IS_REDUNDANT/_IS_REASONABLE_CONDITION
* @param string $expected_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 analyzeIncDec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeIncDec(Node $node): VariableTrackingScope
{
$var_node = $node->children['var'];
if ($var_node instanceof Node && $var_node->kind === ast\AST_VAR) {
$name = $var_node->children['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 getFlattenedClosures
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getFlattenedClosures(Closure $flattener): array
{
\ksort($this->closures);
$merged_closures = [];
foreach ($this->closures as $kind => $closure_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 getSuggestions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getSuggestions(string $name): array
{
if (!$this->strings || $name === '') {
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 visitMethodCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitMethodCall(Node $node): Context
{
if ($this->dim_depth >= 2) {
return $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 analyzeAssignmentToReadOnlyProperty
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeAssignmentToReadOnlyProperty(Property $property, Node $node): void
{
$is_from_phpdoc = $property->isFromPHPDoc();
$context = $property->getContext();
if (!$is_from_phpdoc && $this->context->isInFunctionLikeScope()) {
- 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 visitInstanceof
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitInstanceof(Node $node): Context
{
//$this->checkVariablesDefined($node);
// Only look at things of the form
// `$variable instanceof ClassName`
- 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 analyze
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function analyze(Context $context, CodeBase $code_base): Context
{
// Don't do anything if we care about being
// fast
if (Config::get_quick_mode()) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitFuncDecl(Node $node): Context
{
$function_name = (string)$node->children['name'];
$context = $this->context;
$code_base = $this->code_base;
- 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 visitBreak
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitBreak(Node $node): Context
{
$depth = $node->children['depth'] ?? 1;
if (!\is_int($depth)) {
return $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 analyzeMethodVisibility
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeMethodVisibility(
Method $method,
Node $node
): void {
if ($method->isPublic()) {
- 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 recordOutputReferences
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function recordOutputReferences(FunctionInterface $method): void
{
foreach ($method->getOutputReferenceParamNames() as $output_param_name) {
foreach ($method->getRealParameterList() as $parameter) {
// TODO: Emit an issue if the (at)phan-output-reference is on a non-reference (at)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 toShortString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function toShortString($node): string
{
if (!($node instanceof Node)) {
if ($node === null) {
// use lowercase 'null' instead of '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 deduplicateUnionTypes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function deduplicateUnionTypes($types): \Generator
{
$unique_types = [];
foreach ($types as $lineno => $details) {
$type = $details[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 emitInstance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function emitInstance(
$node,
CodeBase $code_base,
Context $context,
string $issue_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 testClassAccess
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function testClassAccess(
Clazz $source_class,
Clazz $target_class,
CodeBase $code_base
): void {
- 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 checkCanCastToReturnType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function checkCanCastToReturnType(UnionType $expression_type, UnionType $method_return_type): bool
{
if ($expression_type->hasRealTypeSet() && $method_return_type->hasRealTypeSet()) {
$real_expression_type = $expression_type->getRealUnionType();
$real_method_return_type = $method_return_type->getRealUnionType();
- 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"