Showing 3,272 of 4,939 total issues
Method updateDimExpressionWithConditionalFilter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
final protected function updateDimExpressionWithConditionalFilter(
Node $node,
Context $context,
Closure $should_filter_cb,
Closure $filter_union_type_cb,
Method visitYieldFrom
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitYieldFrom(Node $node): Context
{
$context = $this->context;
// Make sure we're actually returning from a method.
if (!$context->isInFunctionLikeScope()) {
Method visitBinaryOp
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitBinaryOp(Node $node): UnionType
{
switch ($node->flags) {
case flags\BINARY_ADD:
return UnionType::fromFullyQualifiedRealString('int|float|array');
Method unionTypeFromNode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unionTypeFromNode(
CodeBase $code_base,
Context $context,
$node,
bool $should_catch_issue_exception = true
Method getVariableStrict
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getVariableStrict(): Variable
{
$node = $this->node;
if (!($node instanceof Node)) {
throw new AssertionError('$this->node must be a node');
Method getFunctionLikeFromDynamicExpression
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getFunctionLikeFromDynamicExpression(): \Generator
{
$code_base = $this->code_base;
$context = $this->context;
$expression = $this->node;
Method getClassForVariable
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getClassForVariable(Node $expr): Clazz
{
if ($expr->kind !== ast\AST_VAR) {
// TODO: Support static properties, (new X()), other expressions with inferable types
throw new NodeException($expr, 'expected simple variable');
Method visitClass
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitClass(Node $node): array
{
[$property_descriptions, $method_descriptions] = parent::visitClass($node);
foreach (self::findGroups($property_descriptions) as $entries) {
$first_entry = array_shift($entries);
Method visitArray
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitArray(Node $node): void
{
$children = $node->children;
if (count($children) <= 1) {
// This plugin will never emit errors if there are 0 or 1 elements.
Method generateStaticElementSuggestionsForClass
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateStaticElementSuggestionsForClass(string $class, string $instance_element_prefix): array
{
// TODO support ::class
if (!class_exists($class)) {
return [];
Function adjustFileMappingContentsForCompletionRequest
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function adjustFileMappingContentsForCompletionRequest(
array $file_mapping_contents,
CompletionRequest $completion_request
): array {
$file = FileRef::getProjectRelativePathForPath($completion_request->getPath());
- 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 applyTemporaryFileMappingForParsePhase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function applyTemporaryFileMappingForParsePhase(CodeBase $code_base, array $temporary_file_mapping_contents): void
{
if (count($temporary_file_mapping_contents) === 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 reloadFilePathListForDaemon
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function reloadFilePathListForDaemon(CodeBase $code_base, Closure $file_path_lister, array $file_mapping_contents, array $file_names = null): void
{
$old_count = $code_base->getParsedFilePathCount();
$file_list = $file_path_lister(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 resolveClassAliasesForAliasSet
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function resolveClassAliasesForAliasSet(FullyQualifiedClassName $original_fqsen, Set $alias_set): void
{
if (!$this->hasClassWithFQSEN($original_fqsen)) {
// The original class does not exist.
// Emit issues at the point of every single class_alias call with that original class.
- 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 suggestSimilarGlobalFunctionInNewerVersion
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function suggestSimilarGlobalFunctionInNewerVersion(
string $namespace,
string $function_name,
Context $context,
bool $suggest_in_global_namespace
- 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 findLineNumberOfCommentForElement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function findLineNumberOfCommentForElement(AddressableElementInterface $element, array $lines, int $i): int
{
$context = $element->getContext();
$entry = FileCache::getOrReadEntry(Config::projectPath($context->getFile()));
- 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 inheritRealParameterDefaults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function inheritRealParameterDefaults(): void
{
foreach ($this->real_parameter_list as $i => $real_parameter) {
$parameter = $this->parameter_list[$i] ?? null;
if (!$parameter || $parameter->isVariadic() || $real_parameter->isVariadic()) {
- 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 getCommentParamAssertionClosure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getCommentParamAssertionClosure(CodeBase $code_base): ?Closure
{
if (!\is_object($this->comment)) {
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 computeNewTypeForComment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function computeNewTypeForComment(CodeBase $code_base, Context $context, UnionType $signature_union_type, UnionType $comment_return_union_type): UnionType
{
$new_type = $comment_return_union_type;
foreach ($comment_return_union_type->getTypeSet() as $type) {
if (!$type->asPHPDocUnionType()->canAnyTypeStrictCastToUnionType($code_base, $signature_union_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 getThisPropertyIfOverridden
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getThisPropertyIfOverridden(string $name): ?UnionType
{
if (!$this->scope->hasVariableWithName(self::VAR_NAME_THIS_PROPERTIES)) {
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"