Showing 3,272 of 4,939 total issues
Method fromNode
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromNode(
Context $context,
CodeBase $code_base,
Node $node,
FullyQualifiedMethodName $fqsen,
Method visitProp
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitProp(Node $node): Context
{
// Get class list first, warn if the class list is invalid.
try {
$class_list = (new ContextNode(
Method visitBinaryAdd
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitBinaryAdd(Node $node): UnionType
{
$code_base = $this->code_base;
$context = $this->context;
$left = UnionTypeVisitor::unionTypeFromNode(
Method getConst
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConst(): GlobalConstant
{
$node = $this->node;
if (!$node instanceof Node) {
throw new AssertionError('$node must be a node');
File GoToDefinitionRequest.php
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\LanguageServer;
IssueFixSuggester
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class IssueFixSuggester
{
/** @see https://www.php.net/levenshtein - levenshtein warns and returns -1 for longer strings */
private const MAX_SUGGESTION_NAME_LENGTH = 255;
Method fromInternalTypeName
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromInternalTypeName(
string $type_name,
bool $is_nullable,
int $source,
array $template_parameter_type_list = []
Method analyzeComposition
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function analyzeComposition(
CodeBase $code_base,
Clazz $class
): void {
// Get the list of all inherited classes.
Method getAnalyzeFunctionCallClosures
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
{
/**
* @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
*/
File MethodSearcherPlugin.php
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Phan\Plugin\Internal;
Method addConstant
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addConstant(
CodeBase $code_base,
Context $context,
int $lineno,
string $name,
Function getFlagSuggestionString
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function getFlagSuggestionString(
string $key
): string {
$trim = static function (string $s): string {
return \rtrim($s, ':');
- 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 finishAnalyzingRemainingStatements
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function finishAnalyzingRemainingStatements(
CodeBase $code_base,
?Request $request,
array $analyze_file_path_list,
array $temporary_file_mapping
- 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 fromFullyQualifiedStringInner
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
protected static function fromFullyQualifiedStringInner(
string $fully_qualified_string
): Type {
if ($fully_qualified_string === '') {
throw new InvalidArgumentException("Type cannot be empty");
- 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 createMatchConditionAnalyzer
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function createMatchConditionAnalyzer($match_case_node): array
{
$match_kind = ($match_case_node->kind ?? null);
try {
if ($match_kind === ast\AST_VAR) {
- 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 phan_error_handler
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function phan_error_handler(int $errno, string $errstr, string $errfile, int $errline): bool
{
global $__no_echo_phan_errors;
if ($__no_echo_phan_errors) {
if ($__no_echo_phan_errors instanceof Closure) {
- 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 visitClassConstDecl
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function visitClassConstDecl(Node $node): Context
{
$class = $this->getContextClass();
foreach ($node->children as $child_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 checkForInvalidNewType
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function checkForInvalidNewType(Node $node, array $class_list): void
{
// This is either a string (new 'something'()) or a class name (new something())
$class_node = $node->children['class'];
if (!$class_node instanceof 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 load
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function load(): void
{
if (!class_exists('\ast\Node')) {
// Fix for https://github.com/phan/phan/issues/2287
require_once __DIR__ . '/ast_shim.php';
- 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 unionTypeFromClassNode
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function unionTypeFromClassNode(
CodeBase $code_base,
Context $context,
$node
): UnionType {
- 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"