Showing 3,272 of 4,939 total issues
Method removeLiteralScalarFromVariable
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
final protected function removeLiteralScalarFromVariable(
Node $var_node,
Context $context,
$value,
bool $strict_equality
Method typeCheckDimAssignment
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function typeCheckDimAssignment(UnionType $assign_type, Node $node): UnionType
{
static $int_or_string_type = null;
static $string_array_type = null;
static $simple_xml_element_type = null;
Method normalizeIfStatement
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function normalizeIfStatement(Node $original_node): array
{
$nodes = [$original_node];
// Repeatedly apply these rules
do {
Method getAnalyzeFunctionCallClosures
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
{
$warn_remove_debug_call = static function (CodeBase $code_base, Context $context, FunctionInterface $function): void {
self::emitIssue(
$code_base,
Method extractGroup
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function extractGroup(): void
{
$pattern = $this->pattern;
if ($pattern[$this->offset] === '?') {
switch ($pattern[++$this->offset] ?? ':') {
Method analyzeParameterStrict
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeParameterStrict(CodeBase $code_base, Context $context, FunctionInterface $method, $argument_node, UnionType $argument_type, Variable $alternate_parameter, UnionType $parameter_type, int $lineno, int $i): void
{
if ($alternate_parameter instanceof Parameter && $alternate_parameter->isPassByReference() && $alternate_parameter->getReferenceType() === Parameter::REFERENCE_WRITE_ONLY) {
return;
}
Method analyzeFunctions
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function analyzeFunctions(CodeBase $code_base, array $file_filter = null): void
{
$plugin_set = ConfigPluginSet::instance();
$has_function_or_method_plugins = $plugin_set->hasAnalyzeFunctionPlugins() || $plugin_set->hasAnalyzeMethodPlugins();
$show_progress = CLI::shouldShowProgress();
Function createRestorePoint
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function createRestorePoint(): array
{
// Create a deep copy of this CodeBase
$clone = clone($this);
// make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
- 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 locateMiscellaneousTokenCompletion
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function locateMiscellaneousTokenCompletion(
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 maybeParsePhanCustomAnnotation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function maybeParsePhanCustomAnnotation(int $i, string $line, string $type, string $case_sensitive_type): void
{
switch ($type) {
case 'phan-forbid-undeclared-magic-properties':
if ($this->checkCompatible('@phan-forbid-undeclared-magic-properties', [Comment::ON_CLASS], $i)) {
- 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 run
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function run(CodeBase $code_base, Closure $file_path_lister, array $options): ?Request
{
if (!$code_base->isUndoTrackingEnabled()) {
throw new AssertionError("Expected undo tracking to be enabled");
}
- 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 mergeMethodParts
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function mergeMethodParts(array $parts): array
{
$prev_parts = [];
$delta = 0;
$results = [];
- 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 18 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
if (!$this->element_type->canCastToType($type->element_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 computeRealElementTypesForDestructuringAccess
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function computeRealElementTypesForDestructuringAccess(array $real_type_set): array
{
$result = [];
foreach ($real_type_set as $type) {
if ($type instanceof StringType) {
- 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 computeRealElementTypesForDimAccess
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function computeRealElementTypesForDimAccess(array $real_type_set): array
{
$result = [];
foreach ($real_type_set as $type) {
if ($type instanceof StringType) {
- 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 applyUnaryBitwiseNotOperatorToList
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function applyUnaryBitwiseNotOperatorToList(array $type_set, bool $is_real): array
{
if (!$type_set) {
// Can be int|string
return UnionType::typeSetFromString($is_real ? 'int|string' : 'int');
- 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 mergeTypeParts
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function mergeTypeParts(array $parts): array
{
$prev_parts = [];
$delta = 0;
$results = [];
- 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 extractNameList
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function extractNameList(string $list_string): array
{
$results = [];
$prev_parts = [];
$delta = 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 getSuggestionsForStringSet
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function getSuggestionsForStringSet(string $target, array $potential_candidates): array
{
if (count($potential_candidates) === 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
Function recursivelyMarkNodesAsPure
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function recursivelyMarkNodesAsPure(): void
{
// Go through the graph. Any nodes that are impure would either never be added to $this->functions,
// or be removed in handleImpureFunction.
$reverse_edges = [];
- 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"