Showing 4,939 of 4,939 total issues
Function removeLiteralScalarFromVariable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
final protected function removeLiteralScalarFromVariable(
Node $var_node,
Context $context,
$value,
bool $strict_equality
- 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 analyzeReturnInGenerator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeReturnInGenerator(
FunctionInterface $method,
Node $node
): void {
$method_generator_type = $method->getReturnTypeAsGeneratorTemplateType();
- 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 checkPassingPropertyByReference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
{
$parameter_type = $parameter->getNonVariadicUnionType();
$expr_node = $argument->children['expr'] ?? null;
if ($expr_node instanceof Node &&
- 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 createConverter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function createConverter(string $file_path, string $file_contents, Request $request = null): TolerantASTConverter
{
if ($request) {
if ($request->shouldUseMappingPolyfill($file_path)) {
// TODO: Rename to something better
- 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 print
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function print(IssueInstance $instance): void
{
$issue = $instance->getIssue();
$message = HTML::htmlTemplate(
$issue->getTemplateRaw(),
- 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 flush
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function flush(): void
{
$document = new \DOMDocument('1.0', 'ISO-8859-15');
$checkstyle = new \DOMElement('checkstyle');
- 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 visitClassConst
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassConst(Node $node): UnionType
{
$class_node = $node->children['class'];
if (!$class_node instanceof Node || $class_node->kind !== ast\AST_NAME) {
// ignore nonsense like (0)::class, and dynamic accesses such as $var::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 visitClassNameNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function visitClassNameNode(Node $node): ?UnionType
{
// Things of the form `new $className()`, `new $obj()`, `new (foo())()`, etc.
if ($node->kind !== \ast\AST_NAME) {
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 dumpTreeAsString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function dumpTreeAsString($ast_node, string $key = '', string $padding = ''): string
{
if ($ast_node instanceof Node) {
$first_part = \sprintf(
"%s%s%s%s\n",
- 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 phpParserMatchArmListToAstMatchArmList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function phpParserMatchArmListToAstMatchArmList(?\Microsoft\PhpParser\Node\DelimitedList\MatchExpressionArmList $arms, int $start_line): ast\Node
{
$ast_arms = [];
foreach ($arms->children ?? [] as $arm) {
if (!$arm instanceof PhpParser\Node\MatchArm) {
- 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 visitCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitCall(Node $node): UnionType
{
$expression = $node->children['expr'];
if (!($expression instanceof Node && $expression->kind === ast\AST_NAME)) {
// Give up on closures, callables
- 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 phpParserMatchConditionListToAstNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function phpParserMatchConditionListToAstNode(?PhpParser\Node\DelimitedList\MatchArmConditionList $condition_list): ?ast\Node
{
if (!$condition_list) {
throw new InvalidNodeException();
}
- 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 phpParserNamespaceUseListToAstUseList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function phpParserNamespaceUseListToAstUseList(array $uses): array
{
$ast_uses = [];
foreach ($uses as $use_clause) {
if (!($use_clause instanceof PhpParser\Node\NamespaceUseGroupClause)) {
- 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 applyToScopeInner
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function applyToScopeInner($node): void
{
if ($node instanceof Node) {
$kind = $node->kind;
if (\in_array($kind, self::SCOPE_START_LIST, 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 visitCall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitCall(Node $node): UnionType
{
$expression = $node->children['expr'];
$function_list_generator = (new ContextNode(
$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 visitClassConst
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassConst(Node $node): UnionType
{
try {
$constant = (new ContextNode(
$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 unionTypeFromNode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function unionTypeFromNode(
CodeBase $code_base,
Context $context,
$node,
bool $should_catch_issue_exception = 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 handleTraitAlias
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function handleTraitAlias(array $adaptations_map, Node $adaptation_node): void
{
$trait_method_node = $adaptation_node->children['method'];
if (!$trait_method_node instanceof Node) {
throw new AssertionError("Expected node for trait alias");
- 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 resolveClassNameInContext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function resolveClassNameInContext(): ?FullyQualifiedClassName
{
// A function argument to resolve into an FQSEN
$arg = $this->node;
- 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 getPhanSignatureArrayFromReflection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getPhanSignatureArrayFromReflection(ReflectionFunctionAbstract $function): array
{
$return_type = $function->getReturnType();
$return_type_representation = getUnionTypeStringForReflectionType($return_type);
$result = [0 => $return_type_representation];
- 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"