Showing 3,272 of 4,939 total issues
Method quickWarn
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function quickWarn(FunctionInterface $method, string $fqsen, Node $node): bool
{
if (!$method->isPure()) {
$fqsen_key = \strtolower(\ltrim($fqsen, "\\"));
$result = UseReturnValuePlugin::HARDCODED_FQSENS[$fqsen_key] ?? null;
Method visitFor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitFor(Node $node): VariableTrackingScope
{
$this->checkIsSideEffectFreeLoopNode($node);
$top_level_statement = $this->top_level_statement;
Method visitBinaryOp
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitBinaryOp(Node $node): Context
{
$flags = $node->flags ?? 0;
switch ($flags) {
case flags\BINARY_BOOL_OR:
Method visitInstanceof
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitInstanceof(Node $node): Context
{
//$this->checkVariablesDefined($node);
// Only look at things of the form
// `$variable instanceof ClassName`
Method visitBinaryCoalesce
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitBinaryCoalesce(Node $node): UnionType
{
$left_node = $node->children['left'];
$left_type = UnionTypeVisitor::unionTypeFromNode(
$this->code_base,
Method emitUndeclaredNamedArgument
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function emitUndeclaredNamedArgument(
CodeBase $code_base,
Context $context,
FunctionInterface $method,
Node $argument
Method visit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visit(Node $node): UnionType
{
// TODO: For some types (e.g. xor, bitwise or), set the type of the variable?
// Or should that be done in PreOrderAnalysisVisitor?
$left = UnionTypeVisitor::unionTypeFromNode(
Method checkCommentParametersAreInOrder
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function checkCommentParametersAreInOrder(CodeBase $code_base, FunctionInterface $method): void
{
$comment = $method->getComment();
if ($comment === null) {
return;
Method parseMultiPartHeredoc
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function parseMultiPartHeredoc(PhpParser\Node\StringLiteral $n, array $children): ast\Node
{
$inner_node_parts = [];
$end_of_start_quote = self::$file_contents[$n->startQuote->start + $n->startQuote->length - 1];
$end_quote_text = $n->endQuote->getText(self::$file_contents);
Method visitTypeUnion
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitTypeUnion(Node $node): UnionType
{
// TODO: Validate that there aren't any duplicates
if (\count($node->children) === 1) {
// Might be possible due to the polyfill in the future.
Method parseNodeInContext
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function parseNodeInContext(CodeBase $code_base, Context $context, Node $node)
{
$kind = $node->kind;
$context->setLineNumberStart($node->lineno);
Method visitStmtList
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitStmtList(Node $node): void
{
if (count($node->children) <= 1) {
return;
}
Consider simplifying this complex logical expression. Open
Open
if (!($o_return_union_type->isEqualTo($return_union_type) || (
($o_return_union_type->containsNullable() && !$o_return_union_type->isNull()) && ($o_return_union_type->nonNullableClone()->isEqualTo($return_union_type)))
)) {
// 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?
Consider simplifying this complex logical expression. Open
Open
if (!$method->isAbstract()
&& !$method->isFromPHPDoc()
&& !$has_interface_class
&& !$return_type->isEmpty()
&& !$method->hasReturn()
Method createRestorePoint
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createRestorePoint(): array
{
// Create a deep copy of this CodeBase
$clone = clone($this);
// make a deep copy of the NamespaceMapEntry objects within parsed_namespace_maps
Method suggestSimilarClassInSameNamespace
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function suggestSimilarClassInSameNamespace(
FullyQualifiedClassName $missing_class,
Context $context,
int $class_suggest_type = IssueFixSuggester::CLASS_SUGGEST_ONLY_CLASSES
): array {
Method fromFullyQualifiedString
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function fromFullyQualifiedString(
string $fully_qualified_string
) {
$key = static::class . '|' . $fully_qualified_string;
Method checkUnreachableCatch
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkUnreachableCatch(array $catch_nodes, Context $context): void
{
if (count($catch_nodes) <= 1) {
return;
}
Method suggestSimilarClass
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function suggestSimilarClass(
CodeBase $code_base,
Context $context,
FullyQualifiedClassName $class_fqsen,
?Closure $filter = null,
Method analyzeForeachIteration
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function analyzeForeachIteration(Context $context, UnionType $expression_union_type, Node $node): Context
{
$code_base = $this->code_base;
$value_node = $node->children['value'];
if ($value_node instanceof Node) {