Showing 3,272 of 4,939 total issues
Method resolveDocCommentForClosure
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function resolveDocCommentForClosure(PhpParser\Node\Expression $node): ?string
{
$doc_comment = $node->getDocCommentText();
if (\Phan\Library\StringUtil::isNonZeroLengthString($doc_comment)) {
return $doc_comment;
File PregRegexCheckerPlugin.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\Node;
Method finalizeAnalyzingURIs
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function finalizeAnalyzingURIs(): void
{
[$uris_to_analyze, $file_path_list] = $this->getFilteredURIsToAnalyze();
// TODO: Add a better abstraction of
if (\count($uris_to_analyze) === 0) {
Method analyze
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function analyze(
FunctionInterface $method,
Node $node,
Context $context,
CodeBase $code_base
Method analyzeMethod
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function analyzeMethod(
CodeBase $code_base,
Method $method
): void {
if ($method->getFQSEN() !== $method->getRealDefiningFQSEN()) {
Request
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Request
{
public const METHOD_ANALYZE_FILES = 'analyze_files'; // has shorthand analyze_file with param 'file'
public const PARAM_METHOD = 'method';
GlobalScope
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
final class GlobalScope extends Scope
{
/**
* Deliberate no-op
*/
File InvokePHPNativeSyntaxCheckPlugin.php
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
use ast\Node;
Method orderForProcessCount
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function orderForProcessCount(
int $process_count,
array $analysis_file_list
): array {
Method removeTruthyFromVariable
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
final protected function removeTruthyFromVariable(Node $var_node, Context $context, bool $suppress_issues, bool $check_empty): Context
{
return $this->updateVariableWithConditionalFilter(
$var_node,
$context,
Method resolveArrayShapeElementTypes
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveArrayShapeElementTypes(Node $node, UnionType $union_type): ?UnionType
{
$dim_node = $node->children['dim'];
$dim_value = $dim_node instanceof Node ? (new ContextNode($this->code_base, $this->context, $dim_node))->getEquivalentPHPScalarValue() : $dim_node;
// TODO: detect and warn about null
Method getElementsFromElementListForDeferredAnalysis
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getElementsFromElementListForDeferredAnalysis(
CodeBase $code_base,
iterable $element_list,
int $total_count,
int &$i
Method analyzeProp
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function analyzeProp(Node $node, bool $is_static): Context
{
$exception_or_null = null;
try {
Method analyzeCallToFunctionLike
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeCallToFunctionLike(
FunctionInterface $method,
Node $node
): void {
$code_base = $this->code_base;
Method resolveArrayShapeElementTypesForOffset
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function resolveArrayShapeElementTypesForOffset(UnionType $union_type, $dim_value, bool $is_computing_real_type_set = false)
{
/**
* @var bool $has_non_array_shape_type this will be true if there are types that support array access
* but have unknown array shapes in $union_type
Method methodFQSENListFromObjectAndMethodName
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function methodFQSENListFromObjectAndMethodName($class_or_expr, string $method_name): array
{
$code_base = $this->code_base;
$context = $this->context;
Function orderForProcessCount
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function orderForProcessCount(
int $process_count,
array $analysis_file_list
): array {
- 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 importMixin
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function importMixin(CodeBase $code_base, Type $type): void
{
$fqsen = FullyQualifiedClassName::fromType($type);
if (!$code_base->hasClassWithFQSEN($fqsen) || $fqsen === $this->fqsen) {
Issue::maybeEmit(
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
protected function canCastToNonNullableType(Type $type): bool
{
if ($type instanceof ScalarType) {
switch ($type::NAME) {
case '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 canStrictCastToUnionType
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function canStrictCastToUnionType(CodeBase $code_base, UnionType $target): bool
{
// Fast-track most common cases first
$type_set = $this->type_set;
// If either type is unknown, we can't call it
- 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"