Showing 3,272 of 4,939 total issues
Method locateMiscellaneousTokenCompletion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CompletionRequest $request,
CodeBase $code_base,
Context $context,
Node $node,
string $incomplete_constant_name,
Function resolveParentTemplateType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function resolveParentTemplateType(array $template_parameter_type_map): UnionType
{
if (\count($template_parameter_type_map) === 0) {
return UnionType::empty();
}
- 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 importTraitAdaptations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function importTraitAdaptations(
CodeBase $code_base,
Clazz $class,
TraitAdaptations $trait_adaptations,
Option $type_option
- 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
string $comment,
CodeBase $code_base,
Context $context,
int $lineno,
int $comment_type,
Function hasFlagsRecursive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function hasFlagsRecursive(CodeBase $code_base, int $flags): bool
{
$current = $this;
$checked = [];
while (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 toStubString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function toStubString(bool $is_internal = false): string
{
$string = '';
$union_type = $this->getNonVariadicUnionType();
- 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 addReference
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addReference(FileRef $file_ref): void
{
if (Config::get_track_references()) {
// Currently, we don't need to track references to PHP-internal methods/functions/constants
// such as PHP_VERSION, strlen(), Closure::bind(), etc.
- 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 analyzePropertyOverrides
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzePropertyOverrides(CodeBase $code_base, array $original_declared_properties): void
{
foreach ($original_declared_properties as $property) {
if ($property->isOverrideIntended() && !$property->isOverride()) {
if ($property->checkHasSuppressIssueAndIncrementCount(Issue::CommentOverrideOnNonOverrideProperty)) {
- 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 (!$this->is_accepting_new_requests) {
// If we fork, don't read any bytes in the input buffer from the worker process.
$this->emitClose();
return $emitted_messages;
}
Method getPropertyByNameInContext
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CodeBase $code_base,
string $name,
Context $context,
bool $is_static,
Node $node = null,
Function loadConfiguredPHPExtensionStubs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function loadConfiguredPHPExtensionStubs(CodeBase $code_base): void
{
$stubs = Config::getValue('autoload_internal_extension_signatures');
foreach ($stubs ?: [] as $extension_name => $path_to_extension) {
$extension_name = (string)$extension_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 analyzeClassConstantOverrides
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeClassConstantOverrides(CodeBase $code_base, array $original_declared_class_constants): void
{
foreach ($original_declared_class_constants as $constant) {
if ($constant->isOverrideIntended() && !$constant->isOverride()) {
if ($constant->checkHasSuppressIssueAndIncrementCount(Issue::CommentOverrideOnNonOverrideConstant)) {
- 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
Context $context,
string $name,
UnionType $type,
int $flags,
FullyQualifiedMethodName $fqsen,
Avoid deeply nested control flow statements. Open
if (StringUtil::isNonZeroLengthString($class_description)) {
return "Construct an instance of `{$class->getFQSEN()}`.\n\n$class_description";
}
Function magicPropertyFromCommentLine
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function magicPropertyFromCommentLine(
string $line,
int $i
): ?Property {
// Note that the type of a property can be left out (@property $myVar) - This is equivalent to @property mixed $myVar
- 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
Context $context,
string $name,
UnionType $type,
int $flags,
FullyQualifiedFunctionName $fqsen,
Avoid deeply nested control flow statements. Open
if (isset($new_lines[0])) {
// @phan-suppress-next-line PhanAccessClassConstantInternal
$new_lines[0] = \preg_replace(Builder::RETURN_COMMENT_REGEX, $remove_type ? '' : '`\0`', $new_lines[0]);
}
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
string $name,
UnionType $type,
int $flags,
FullyQualifiedPropertyName $fqsen,
Function extractDescriptionFromDocCommentOfAncestorOfClassElement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function extractDescriptionFromDocCommentOfAncestorOfClassElement(
ClassElement $element,
CodeBase $code_base,
array &$checked_class_fqsens = []
): ?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
Avoid deeply nested control flow statements. Open
if (isset($new_lines[0])) {
$did_build_from_phpdoc_tag = true;
// @phan-suppress-next-line PhanAccessClassConstantInternal
$new_lines[0] = \preg_replace(Builder::PARAM_COMMENT_REGEX, $remove_type ? '' : '`\0`', $new_lines[0]);
}