Showing 3,272 of 4,939 total issues
Method checkDeprecatedUnparenthesizedConditional
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkDeprecatedUnparenthesizedConditional(Node $node, Node $cond): void
{
if ($cond->flags & flags\PARENTHESIZED_CONDITIONAL) {
// The condition is unambiguously parenthesized.
return;
Method getLoopNodeTypeFetcher
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getLoopNodeTypeFetcher(CodeBase $code_base, $node): ?Closure
{
if (!($node instanceof Node)) {
// This scalar won't change.
return null;
Method phpParserIfStmtToAstIfStmt
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function phpParserIfStmtToAstIfStmt(PhpParser\Node\Statement\IfStatementNode $node, int $start_line): ast\Node
{
$if_elem = static::astIfElem(
static::phpParserNodeToAstNode($node->expression),
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable return_null_on_empty is false.
Method dumpTreeAsString
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dumpTreeAsString($ast_node, string $key = '', string $padding = ''): string
{
if ($ast_node instanceof Node) {
$first_part = \sprintf(
"%s%s%s%s\n",
Method phpParserVisibilityToAstVisibility
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function phpParserVisibilityToAstVisibility(array $visibility, bool $automatically_add_public = true): int
{
$ast_visibility = 0;
foreach ($visibility as $token) {
switch ($token->kind) {
Method applyIfNegatedToIfElseReduction
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function applyIfNegatedToIfElseReduction(Node $node): Node
{
if (count($node->children) !== 1) {
throw new AssertionError("Expected one child node");
}
Method getEquivalentArraySet
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getEquivalentArraySet(Node $node): ?array
{
$elements = [];
$context_node = null;
foreach ($node->children as $child_node) {
Method visitType
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitType(Node $node): UnionType
{
switch ($node->flags) {
case \ast\flags\TYPE_ARRAY:
return ArrayType::instance(false)->asRealUnionType();
Method getVariable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getVariable(): Variable
{
$node = $this->node;
if (!($node instanceof Node)) {
throw new AssertionError('$this->node must be a node');
Method updateSignatureParamNames
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateSignatureParamNames(string $function_like_name, array $arguments_from_phan): array
{
$arguments_from_external_stub = $this->parseFunctionLikeSignature($function_like_name);
if (is_null($arguments_from_external_stub)) {
return $arguments_from_phan;
Method visitIf
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitIf(Node $node): void
{
// @phan-suppress-next-line PhanUndeclaredProperty set by ASTSimplifier
if (isset($node->is_simplified)) {
$first_child = end($node->children);
Method analyzePostponedMethod
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzePostponedMethod(
CodeBase $code_base,
FunctionInterface $method
): void {
if ($method instanceof Method) {
Function locateGlobalConstantCompletion
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function locateGlobalConstantCompletion(
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 usage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function usage(string $msg = '', ?int $exit_code = EXIT_SUCCESS, int $usage_type = UsageException::PRINT_NORMAL, bool $forbid_color = true): void
{
global $argv;
if ($msg !== '') {
- 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 locateGlobalFunctionCompletion
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function locateGlobalFunctionCompletion(
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 childSignalHandler
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function childSignalHandler(int $signo, $status = null, ?int $pid = null): void
{
// test
if ($signo !== SIGCHLD) {
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 analyzeInheritedMethods
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function analyzeInheritedMethods(CodeBase $code_base): void
{
if ($this->isClass() && !$this->isAbstract()) {
foreach ($this->getMethodMap($code_base) as $method) {
if ($method->getRealDefiningFQSEN() === $method->getFQSEN()) {
- 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 addProperty
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function addProperty(
CodeBase $code_base,
Property $property,
Option $type_option,
bool $from_trait = 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 locateConstructorDefinitionForUnionType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function locateConstructorDefinitionForUnionType(
GoToDefinitionRequest $request,
CodeBase $code_base,
UnionType $union_type
): 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 getProjectRelativePathForPath
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getProjectRelativePathForPath(string $cwd_relative_path): string
{
if ($cwd_relative_path === '') {
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"