Showing 4,939 of 4,939 total issues
Function getRequestData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getRequestData(): ?array
{
if (!$this->did_read_request_data) {
$response_connection = $this->connection;
if (!$response_connection) {
- 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 locateClassCompletion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function locateClassCompletion(
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 supportsColor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function supportsColor($output): bool
{
if (self::isDaemonOrLanguageServer()) {
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 didChangeWatchedFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function didChangeWatchedFiles(array $changes): void
{
// invalidate Phan's cache for these files if changed, added, or modified outside of the IDE
foreach ($changes as $change) {
$this->file_mapping->removeOverrideURI($change->uri);
- 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 kindForElement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function kindForElement(TypedElementInterface $element): ?int
{
if ($element instanceof ClassConstant) {
return CompletionItemKind::VARIABLE;
} elseif ($element instanceof Clazz) {
- 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 checkCanDaemonize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function checkCanDaemonize(string $protocol, string $opt): void
{
$opt = strlen($opt) >= 2 ? "--$opt" : "-$opt";
if (!in_array($protocol, \stream_get_transports(), true)) {
throw new UsageException("The $protocol:///path/to/file schema is not supported on this system, cannot create a daemon with $opt", 1);
- 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 locateClassDefinitionForUnionType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function locateClassDefinitionForUnionType(
GoToDefinitionRequest $request,
CodeBase $code_base,
UnionType $union_type
): bool {
- 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 preloadBeforeForkingAnalysisWorkers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function preloadBeforeForkingAnalysisWorkers(CodeBase $code_base): void
{
if (Config::getValue('language_server_use_pcntl_fallback')) {
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 createGoToDefinitionClosure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function createGoToDefinitionClosure(GoToDefinitionRequest $request, CodeBase $code_base): Closure
{
/**
* @param list<Node> $parent_node_list
*/
- 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 isTemplateTypeUsed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function isTemplateTypeUsed(TemplateType $type): bool
{
if ($this->getUnionType()->usesTemplateType($type)) {
// used in `@return`
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 computeNeedsRecursiveAnalysis
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function computeNeedsRecursiveAnalysis(): bool
{
if (!$this->getNode()) {
// E.g. this can be the case for magic methods, internal methods, stubs, etc.
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 checkCanAccessProtectedElement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function checkCanAccessProtectedElement(CodeBase $code_base, FullyQualifiedClassName $defining_fqsen, FullyQualifiedClassName $accessing_class_fqsen): bool
{
$accessing_class_type = $accessing_class_fqsen->asType();
$type_of_class_of_property = $defining_fqsen->asType();
- 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 isSubtypeOf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isSubtypeOf(Type $type): bool
{
// TODO more specific
if (!$this->canCastToType($type)) {
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 keyTypeFromUnionTypeKeys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function keyTypeFromUnionTypeKeys(UnionType $union_type): int
{
$key_types = self::KEY_EMPTY;
foreach ($union_type->getTypeSet() as $type) {
if ($type instanceof GenericArrayType) {
- 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 getNamespaceMapFor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getNamespaceMapFor(
int $flags,
string $name
): FullyQualifiedGlobalStructuralElement {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function toFunctionSignatureArray(): array
{
// no need for returns ref yet
$return_type = $this->return_type;
$stub = [$return_type->__toString()];
- 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 withAssociativeArraysForSet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function withAssociativeArraysForSet(array $type_set, bool $can_reduce_size): array
{
foreach ($type_set as $i => $type) {
if (!$type instanceof ArrayType) {
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 nonFalseClone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function nonFalseClone(): UnionType
{
$builder = new UnionTypeBuilder();
$did_change = false;
foreach ($this->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 hasLiterals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function hasLiterals(): bool
{
foreach ($this->type_set as $type) {
if ($type instanceof LiteralTypeInterface) {
$value = $type->getValue();
- 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 instance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function instance(bool $is_nullable)
{
if ($is_nullable) {
static $nullable_instance = 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"