Showing 3,272 of 4,939 total issues
Consider simplifying this complex logical expression. Open
if ($left_is_array_like
&& !$right->hasArrayLike()
&& !$right_can_cast_to_array
&& !$right->isEmpty()
&& !$right->containsNullable()
Consider simplifying this complex logical expression. Open
if ($union_type->isDefinitelyUndefined()
|| (!$union_type->isEmpty()
&& $union_type->isNativeType()
&& !$union_type->hasTypeMatchingCallback(static function (Type $type): bool {
return !$type->isNullableLabeled() && ($type instanceof MixedType || $type instanceof ObjectType);
Method addParamsToScopeOfFunctionOrMethod
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addParamsToScopeOfFunctionOrMethod(
Context $context,
CodeBase $code_base,
FunctionInterface $function,
Comment $comment
Method asExpandedTypes
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function asExpandedTypes(
CodeBase $code_base,
int $recursion_depth = 0
): UnionType {
// We're going to assume that if the type hierarchy
Method canCastToUnionTypeHandlingTemplates
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function canCastToUnionTypeHandlingTemplates(
UnionType $target,
CodeBase $code_base
): bool {
// Fast-track most common cases first
Method asExpandedTypesPreservingTemplate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function asExpandedTypesPreservingTemplate(
CodeBase $code_base,
int $recursion_depth = 0
): UnionType {
// We're going to assume that if the type hierarchy
Method addEntriesForClass
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function addEntriesForClass(
CtagsEntrySet $entries,
CodeBase $code_base,
FullyQualifiedClassName $class_fqsen,
Clazz $class
Method analyzeCallableWithArgumentTypes
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function analyzeCallableWithArgumentTypes(
array $argument_types,
FunctionInterface $method,
array $arguments = [],
bool $erase_old_return_type = false
Method analyzeMethodWithArgumentTypes
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeMethodWithArgumentTypes(
Node $argument_list_node,
FunctionInterface $method
): void {
$method = $this->findDefiningMethod($method);
Method getClassList
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getClassList(
bool $ignore_missing_classes = false,
int $expected_type_categories = self::CLASS_LIST_ACCEPT_ANY,
string $custom_issue_type = null,
bool $warn_if_wrong_type = true
Method parseFile
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function parseFile(CodeBase $code_base, string $file_path, bool $suppress_parse_errors = false, string $override_contents = null, bool $is_php_internal_stub = false, ?Request $request = null): Context
{
$original_file_path = $file_path;
$code_base->setCurrentParsedFile($file_path);
if ($is_php_internal_stub) {
File DuplicateArrayKeyPlugin.php
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\Node;
Method magicMethodFromCommentLine
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function magicMethodFromCommentLine(
string $line,
int $comment_line_offset
): ?Method {
// https://phpdoc.org/docs/latest/references/phpdoc/tags/method.html
Method dumpClassDot
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function dumpClassDot(string $title, array $graph = null): void
{
if (!$graph) {
$graph = $this->cgraph;
}
Method finalizeProcess
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function finalizeProcess(CodeBase $code_base): void
{
if (!self::$use_dynamic) {
return;
}
Method getOrCreateProperty
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOrCreateProperty(
string $property_name,
bool $is_static
): Property {
Function canCastToNonNullableTypeWithoutConfig
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableTypeWithoutConfig(Type $type): bool
{
if ($type instanceof ArrayType) {
if ($type instanceof GenericArrayType) {
if (!$this->element_type->canCastToTypeWithoutConfig($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 canCastToUnionTypeWithoutConfig
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function canCastToUnionTypeWithoutConfig(
UnionType $target
): bool {
// Fast-track most common cases first
$type_set = $this->type_set;
- 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 internalFunctionSignatureMap
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function internalFunctionSignatureMap(int $target_php_version): array
{
static $php73_map = [];
if (!$php73_map) {
- 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 genericArrayElementTypes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function genericArrayElementTypes(bool $add_real_types = false): UnionType
{
// This is frequently called, and has been optimized
$result = [];
$type_set = $this->type_set;
- 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"