Showing 3,272 of 4,939 total issues
Method visitConditional
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitConditional(Node $node): UnionType
{
$cond_node = $node->children['cond'];
$cond_truthiness = self::checkCondUnconditionalTruthiness($cond_node);
// For the shorthand $a ?: $b, the cond node will be the truthy value.
Method unionTypeFromClassNode
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unionTypeFromClassNode(
CodeBase $code_base,
Context $context,
$node
): UnionType {
File Func.php
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Element;
Method functionListFromFunction
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function functionListFromFunction(
FunctionInterface $function
): array {
// See if we have any type information for this
// internal function
Function accept
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static function accept(CodeBase $code_base, Closure $file_path_lister, Responder $responder, bool $fork): ?Request
{
FileCache::clear();
$request = $responder->getRequestData();
- 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 recordHoverTextForElementType
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function recordHoverTextForElementType(
CodeBase $code_base,
Context $context,
TypedElementInterface $element
): 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 canCastToNonNullableType
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
return $this->canCastToGenericArrayKeys($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 canCastToNonNullableTypeWithoutConfig
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
// TODO: WithoutConfig here as well?
- 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 canCastToUnionTypeHandlingTemplates
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToUnionTypeHandlingTemplates(
UnionType $target,
CodeBase $code_base
): bool {
// Fast-track most common cases first
- 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 analyzeSubstituteVarAssert
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeSubstituteVarAssert(CodeBase $code_base, Context $context, string $text): void
{
$has_known_annotations = false;
if (\preg_match_all(self::PHAN_VAR_REGEX, $text, $matches, \PREG_SET_ORDER) > 0) {
$has_known_annotations = 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 getReturnTypeOverridesStatic
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static function getReturnTypeOverridesStatic(): array
{
/**
* @param list<Node|int|string|float> $args
*/
- 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 calculateNarrowedUnionType
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static function calculateNarrowedUnionType(CodeBase $code_base, Context $context, UnionType $old_type, UnionType $asserted_object_type): UnionType
{
$new_type_set = [];
foreach ($old_type->getTypeSet() as $type) {
if ($type instanceof MixedType) {
- 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 visitArgList
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function visitArgList(Node $node): Context
{
$argument_name_set = [];
$has_unpack = 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 inheritPHPDoc
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private static function inheritPHPDoc(
CodeBase $code_base,
Method $method,
Method $o_method
): 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 analyzeReturnStrict
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeReturnStrict(
CodeBase $code_base,
FunctionInterface $method,
UnionType $expression_type,
UnionType $method_return_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 analyzeProp
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeProp(Node $node, bool $is_static): UnionType
{
// Either expr(instance) or class(static) is set
$expr_node = $node->children['expr'] ?? null;
try {
- 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
File GenericIterableType.php
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
Method visitClass
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitClass(Node $node): Context
{
if ($node->flags & \ast\flags\CLASS_ANONYMOUS) {
$class_name = (new ContextNode(
$this->code_base,
ConditionVisitor
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class ConditionVisitor extends KindVisitorImplementation implements ConditionVisitorInterface
{
use ConditionVisitorUtil;
/** @internal */
Method visitClassConstDecl
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitClassConstDecl(Node $node): Context
{
$class = $this->getContextClass();
foreach ($node->children as $child_node) {