Showing 3,272 of 4,939 total issues
Method visitClass
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitClass(Node $node): void
{
if (!Config::get_track_references()) {
return;
}
Function getMethodsMapGroupedByDefiningFQSEN
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getMethodsMapGroupedByDefiningFQSEN(): Map
{
$methods_by_defining_fqsen = new Map();
'@phan-var Map<FullyQualifiedMethodName,ArrayObject<Method>> $methods_by_defining_fqsen';
foreach ($this->method_set as $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 addPHPBinariesForSyntaxCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function addPHPBinariesForSyntaxCheck(array $binaries): void
{
$resolved_binaries = [];
foreach ($binaries as $binary) {
if ($binary === '') {
- 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 locateClassConstantCompletion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function locateClassConstantCompletion(
CompletionRequest $request,
CodeBase $code_base,
Context $context,
Node $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 build
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function build(): Comment
{
foreach ($this->lines as $i => $line) {
if (\strpos($line, '@') === false) {
continue;
- 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 setMagicMethodMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function setMagicMethodMap(
array $magic_method_map,
CodeBase $code_base
): bool {
if (count($magic_method_map) === 0) {
- 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 checkConstantCompatibility
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function checkConstantCompatibility(
CodeBase $code_base,
ClassConstant $inherited_constant,
ClassConstant $overriding_constant
): void {
- 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 getAncestorElement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getAncestorElement(CodeBase $code_base, FullyQualifiedClassName $ancestor_fqsen, ClassElement $element): ?ClassElement
{
if (!$code_base->hasClassWithFQSEN($ancestor_fqsen)) {
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 getUnionTypeRepresentationForIssue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getUnionTypeRepresentationForIssue(): string
{
$union_type = $this->getNonVariadicUnionType()->asNormalizedTypes();
if ($union_type->isEmpty()) {
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 magicParamFromMagicMethodParamString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function magicParamFromMagicMethodParamString(
string $param_string,
int $param_index,
int $comment_line_offset
): ?Parameter {
- 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 methodListFromReflectionClassAndMethod
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function methodListFromReflectionClassAndMethod(
Context $context,
\ReflectionClass $class,
\ReflectionMethod $reflection_method
): array {
- 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 applyOverride
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function applyOverride(string $key, $value): void
{
switch ($key) {
case 'param':
foreach ($value as $parameter) {
- 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 toFunctionSignatureArray
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function toFunctionSignatureArray(): array
{
$return_type = $this->getUnionType();
$stub = [$return_type->__toString()];
'@phan-var array<mixed,string> $stub'; // TODO: Should not warn about PhanTypeMismatchDimFetch in isset below
- 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 extractTagSummary
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function extractTagSummary(array $lines, int $i): array
{
$summary = [];
$summary[] = self::trimLine($lines[$i]);
for ($j = $i + 1; $j < count($lines); $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 getMarkupDescription
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getMarkupDescription(): string
{
$string = '';
// It's an error to have visibility or abstract in an interface's stub (e.g. JsonSerializable)
if ($this->isPrivate()) {
- 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 getReferencedClasses
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getReferencedClasses(): Generator
{
// Whether union types or types have been seen already for this ArrayShapeType
$seen = [];
foreach ($this->field_types as $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 canCastToNonNullableFunctionLikeDeclarationType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToNonNullableFunctionLikeDeclarationType(FunctionLikeDeclarationType $type): bool
{
if ($this->required_param_count > $type->required_param_count) {
return false;
}
- 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 applyUnaryNotOperatorToList
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function applyUnaryNotOperatorToList(array $type_set): array
{
$contains_falsey = false;
$contains_truthy = false;
foreach ($type_set as $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 canCastToTypeHandlingTemplates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
{
// Check to see if we have an exact object match
if ($this === $type) {
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 applyBoolCastToList
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static function applyBoolCastToList(array $type_set): array
{
$contains_falsey = false;
$contains_truthy = false;
foreach ($type_set as $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"