Showing 3,272 of 4,939 total issues
Method recursivelyMarkNodesAsPure
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function recursivelyMarkNodesAsPure(): void
{
// Go through the graph. Any nodes that are impure would either never be added to $this->functions,
// or be removed in handleImpureFunction.
$reverse_edges = [];
Method astDump
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function astDump($ast, int $options = 0): string
{
if ($ast instanceof Node) {
$result = Parser::getKindName($ast->kind);
Method getParameterCategory
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getParameterCategory(Node $method_node): string
{
$kind = $method_node->kind;
if ($kind === ast\AST_CLOSURE) {
return Issue::UnusedClosureParameter;
Method visitAssignOp
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitAssignOp(Node $node): VariableTrackingScope
{
$expr = $node->children['expr'];
if ($expr instanceof Node) {
$this->scope = $this->analyze($this->scope, $expr);
Method visitConstDecl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitConstDecl(Node $node): Context
{
foreach ($node->children as $child_node) {
if (!$child_node instanceof Node) {
throw new AssertionError("Expected global constant element to be a Node");
Method combineTypesAfterStrictEqualityCheck
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function combineTypesAfterStrictEqualityCheck(UnionType $old_union_type, UnionType $new_union_type): UnionType
{
// TODO: Be more precise about these checks - e.g. forbid anything such as stdClass == false in the new type
if (!$new_union_type->hasRealTypeSet()) {
return $new_union_type->withRealTypeSet($old_union_type->getRealTypeSet());
Method isAssignmentOrNestedAssignment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function isAssignmentOrNestedAssignment(Node $node): ?bool
{
$parent_node_list = $this->parent_node_list;
$parent_node = \end($parent_node_list);
if (!$parent_node instanceof Node) {
Method checkForInfiniteRecursion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkForInfiniteRecursion(Node $node, FunctionInterface $method): void
{
$argument_list_node = $node->children['args'];
$kind = $node->kind;
if ($kind === ast\AST_METHOD_CALL || $kind === ast\AST_NULLSAFE_METHOD_CALL) {
Method print
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function print(IssueInstance $instance): void
{
$issue = $instance->getIssue();
$message = [
'type' => 'issue',
Method visitInstanceof
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitInstanceof(Node $node): Context
{
try {
// Fetch the class list, and emit warnings as a side effect.
// TODO: Unify UnionTypeVisitor, AssignmentVisitor, and PostOrderAnalysisVisitor
Method print
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function print(IssueInstance $instance): void
{
$issue = $instance->getIssue();
$message = [
'type' => 'issue',
Method phpParserListToAstList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function phpParserListToAstList(PhpParser\Node\Expression\ListIntrinsicExpression $n, int $start_line): ast\Node
{
$ast_items = [];
$prev_was_element = false;
foreach ($n->listElements->children ?? [] as $item) {
Method checkInvalidUnpackKeyType
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkInvalidUnpackKeyType(Node $node, UnionType $union_type, bool $is_array_spread): void
{
$is_invalid_because_associative = false;
if (!$is_array_spread) {
foreach ($union_type->getTypeSet() as $type) {
Method analyzeReturnTypeOfFunctionLike
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function analyzeReturnTypeOfFunctionLike(CodeBase $code_base, FunctionInterface $method): void
{
$union_type = $method->getUnionType();
if ($union_type->isVoidType()) {
self::emitIssue(
Method analyzeEqualityCheck
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeEqualityCheck(Node $node): void
{
['left' => $left, 'right' => $right] = $node->children;
$left_is_const = ParseVisitor::isConstExpr($left);
$right_is_const = ParseVisitor::isConstExpr($right);
Method generateStaticObjectCompletions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function generateStaticObjectCompletions(array $tokens, string $completed_text): array
{
$i = count($tokens) - 1;
$this->appendToLogFile("generateStaticObjectCompletions tokens = " . StringUtil::jsonEncode($tokens) . "\n");
while (!is_array($tokens[$i]) || $tokens[$i][0] !== T_DOUBLE_COLON) {
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
string $name,
UnionType $type,
int $flags,
FullyQualifiedClassName $fqsen,
Method analyzeParameter
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static function analyzeParameter(CodeBase $code_base, Context $context, FunctionInterface $method, UnionType $argument_type, int $lineno, int $i, $argument_node, ?Node $node): void
Method analyzePassByReferenceArgument
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
CodeBase $code_base,
Context $context,
Node $argument,
array $argument_list,
FunctionInterface $method,
Consider simplifying this complex logical expression. Open
Open
if (!$o_parameter_union_type->isEqualTo($parameter_union_type) &&
!($parameter_union_type->containsNullable() && $o_parameter_union_type->isEqualTo($parameter_union_type->nonNullableClone()))
) {
// There is one exception to this in php 7.1 - the pseudo-type "iterable" can replace ArrayAccess/array in a subclass
// TODO: Traversable and array work, but Iterator doesn't. Check for those specific cases?