Showing 3,272 of 4,939 total issues
Function read
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function read(): bool
{
if ($this->done) {
return 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 recursivelyCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function recursivelyCheck(Node $node): void
{
switch ($node->kind) {
// TODO: Handle phan-closure-scope.
// case ast\AST_CLOSURE:
- 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 visitClass
has a Cognitive Complexity of 10 (exceeds 5 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);
- 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 visitClass
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function visitClass(Node $node): array
{
$class = $this->context->getClassInScope($this->code_base);
$property_descriptions = [];
$method_descriptions = [];
- 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 analyzePostponedMethod
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzePostponedMethod(
CodeBase $code_base,
FunctionInterface $method
): void {
if ($method instanceof Method) {
- 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 visitBinaryOp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function visitBinaryOp(Node $node): void
{
$flags = $node->flags;
if (!\array_key_exists($flags, self::REDUNDANT_BINARY_OP_SET)) {
// Nothing to warn about
- 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 computeEditsForParamTypeDeclaration
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function computeEditsForParamTypeDeclaration(
FileCacheEntry $contents,
FunctionLike $declaration,
string $param_name,
string $shorter_param_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 checkUnaryOpOfConditional
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function checkUnaryOpOfConditional(Node $cond_node, $true_node_hash): void
{
if ($cond_node->flags !== ast\flags\UNARY_BOOL_NOT) {
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 tokenizeRegexParts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function tokenizeRegexParts(string $inner): Generator
{
$inner_len = strlen($inner);
for ($j = 0; $j < $inner_len;) {
switch ($c = $inner[$j]) {
- 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 generateStaticObjectCompletions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function generateStaticObjectCompletions(array $tokens, string $completed_text): array
{
$i = count($tokens) - 1;
$this->appendToLogFile("generateStaticObjectCompletions tokens = " . StringUtil::jsonEncode($tokens) . "\n");
while (!is_array($tokens[$i]) || $tokens[$i][0] !== T_DOUBLE_COLON) {
- 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 init
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function init(): void
{
static $did_init = false;
if ($did_init) {
return;
Method recordDefinitionOfTypeFQSEN
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function recordDefinitionOfTypeFQSEN(
CodeBase $code_base,
FQSEN $type_fqsen
): void {
$record_definition = function (AddressableElementInterface $element) use ($code_base): void {
Method maybeReadConfigFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function maybeReadConfigFile(bool $require_config_exists): void
{
// If the file doesn't exist here, try a directory up
$config_file_name = $this->config_file;
Method reloadFilePathListForDaemon
has 27 lines of code (exceeds 25 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);
Method progress
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function progress(
string $msg,
float $p,
$details = null,
?int $offset = null,
Method getGettersMap
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGettersMap(CodeBase $code_base): array
{
if ($this->isInterface()) {
return [];
}
Method checkConstantCompatibility
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function checkConstantCompatibility(
CodeBase $code_base,
ClassConstant $inherited_constant,
ClassConstant $overriding_constant
): void {
Method warnAboutUnusedUseElements
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function warnAboutUnusedUseElements(CodeBase $code_base): void
{
foreach ($this->namespace_map as $flags => $entries_for_flag) {
foreach ($entries_for_flag as $namespace_map_entry) {
if ($namespace_map_entry->is_used) {
Method computeRealElementTypesForDimAccess
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function computeRealElementTypesForDimAccess(array $real_type_set): array
{
$result = [];
foreach ($real_type_set as $type) {
if ($type instanceof StringType) {
Method computeRealElementTypesForDestructuringAccess
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function computeRealElementTypesForDestructuringAccess(array $real_type_set): array
{
$result = [];
foreach ($real_type_set as $type) {
if ($type instanceof StringType) {