Showing 3,272 of 4,939 total issues
Function checkVarKindOfAssign
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function checkVarKindOfAssign(Node $var): void
{
if ($var->kind === ast\AST_VAR) {
return;
} elseif ($var->kind === ast\AST_PROP) {
- 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 getOrCreateVariableForReferenceParameter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getOrCreateVariableForReferenceParameter(Parameter $parameter, ?Parameter $real_parameter): Variable
{
// Return the original variable if it existed
try {
$variable = $this->getVariable();
- 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 getFunctionFromNode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getFunctionFromNode(bool $return_placeholder_for_undefined = false): iterable
{
$expression = $this->node;
if (!($expression instanceof Node)) {
if (!\is_string($expression)) {
- 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
Avoid deeply nested control flow statements. Open
if ($dim_type->containsNullable() && $dim_type->nonNullableClone()->canCastToUnionType($expected_key_type)) {
$issue_type = Issue::TypeMismatchDimFetchNullable;
}
Avoid deeply nested control flow statements. Open
if ($this->should_catch_issue_exception) {
$this->emitIssue(
$issue_type,
$node->lineno,
(string)$union_type,
Avoid deeply nested control flow statements. Open
if ($union_type->isType(NullType::instance(false))) {
$custom_issue_type = Issue::TypeExpectedObjectPropAccessButGotNull;
}
Function parseMethodSignature
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseMethodSignature(string $class_name, string $method_name): ?array
{
$this->initStubs();
if ($class_name[0] !== '\\') {
$class_name = '\\' . $class_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 processVariable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function processVariable(File $phpcs_file, $stack_ptr)
{
if ($this->isExcluded($phpcs_file)) {
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 finalizeProcess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function finalizeProcess(CodeBase $code_base): void
{
foreach (self::$method_return_types as $type_info) {
$function = $type_info->function;
$function_context = $function->getContext();
- 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 extractMethodParams
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function extractMethodParams(SimpleXMLElement $param): array
{
if ($param->count() === 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
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Issue $issue,
string $file,
int $line,
array $template_parameters,
Suggestion $suggestion = null,
Function parseMethodSignature
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseMethodSignature(string $class_name, string $method_name): ?array
{
$this->initStubs();
if ($class_name[0] !== '\\') {
$class_name = '\\' . $class_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 getAnalyzeFunctionCallClosures
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
{
/**
* Analyzes a printf-like function with a format directive in the first position.
* @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
- 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 main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function main()
{
self::$basename = dirname(realpath(__DIR__));
$file_contents = array_merge(
self::readFileContents(self::$basename . '/tests/files/src'),
- 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 computeKnownEntities
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function computeKnownEntities(): array
{
$this->known_entities = [];
foreach (['doc-base/entities/global.ent', 'en/contributors.ent', 'en/extensions.ent', 'en/language-defs.ent', 'en/language-snippets.ent'] as $sub_path) {
$abs_path = "$this->doc_base_directory/$sub_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 analyzeAddressableElement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeAddressableElement(
CodeBase $code_base,
AddressableElement $element
): void {
// Get the set of suppressed issues on the element
- 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
Method parseFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function parseFile(CodeBase $code_base, string $file_path, bool $suppress_parse_errors = false, string $override_contents = null, bool $is_php_internal_stub = false, ?Request $request = null): Context
Function extractUnionType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function extractUnionType(array $flags): UnionType
{
static $type_lookup = null;
if ($type_lookup === null) {
$type_lookup = [
- 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 parseNodeInContext
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function parseNodeInContext(CodeBase $code_base, Context $context, Node $node)
{
$kind = $node->kind;
$context->setLineNumberStart($node->lineno);
- 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
Method emitIssueAndSuggestion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CodeBase $code_base,
Context $context,
string $issue_type,
string $message,
array $args,