Inspectopedia Help

Probable bugs

'var_export' or 'print_r' call is used without 'return' argument  

Reports var_export() and print_r() calls without the return argument when their results are explicitly used.

Assignment in condition  

Reports the assignments that are used in conditional expressions.

Case with specified value not found in enum  

Reports the arguments of enum's from method calls that are not found in target enum classes.

Concatenation with arithmetic usage  

Reports the string concatenation expressions that are used together with +, -, <<, and >> operators.

Constant reassignment  

Reports reassignments of constants.

Division by zero  

Reports division by zero or modulo by zero.

Duplicate arm in 'match' expression  

Reports duplicate bodies in match arms.

Duplicate array keys  

Reports duplicate keys in array declarations.

Duplicate branch in switch statement  

Reports the switch statements containing the same code in different branches.

Duplicate case in switch statement  

Reports duplicate case expressions in switch statements.

Duplicate character in function call  

Reports duplicate characters provided in the characters argument of functions like ltrim or str_words_counts.

Duplicate condition  

Reports duplicate conditions in match expressions.

Empty index operator not supported for strings  

Reports the usages of empty index operator ([]) on strings.

Expression result unused  

Reports the expressions that are calculated, but the calculation result is not used anywhere.

Field reference does not match object shape  

Reports reference to a property whose name does not match the name specified via an #[ObjectShape] attribute or in the PHPDoc comment.

Foreach array is used as value  

Reports the variables that are used in a foreach loop as both an array expression and an array's key or value (for example, foreach ($items as $items) {}).

Format function parameters mismatch  

Reports the arguments of a format function (such as printf or sprintf) that are not mapped to any parameters or specification conversions.

Goto into loop statement  

Reports the goto labels that are located inside loops or switch statements.

Invalid function result used  

Reports the usages of a void or never function's return value.

Invalid string offset usage  

Reports invalid string offset usages that will result in a runtime error.

Invalid type of unpacked argument  

Reports unpacked function arguments and array elements whose type is neither array nor Traversable.

Local object is used only for writing properties  

Reports the variable assignments to new objects that are used only for writing the object's properties without observable side effects.

Method '__toString' implementation  

Reports the attempts to convert the objects having no __toString method implementation to string.

Method '__toString' return type  

Reports the __toString methods that do not return string.

Misordered 'rand' function arguments  

Reports the rand($min, $max) family function calls in which the max argument is less than min.

Missing 'break' statement  

Reports the case clauses in switch statements that do not end with a break or a return statement.

Missing parent call for constructor  

Reports the constructors that do not call their parent constructor.

Missing parent call for magic methods  

Reports the magic methods that do not call their parent magic method.

Missing parent call for method  

Reports the methods that do not call their parent method.

Modification of the array returned from function by value won't have any effect  

Reports call to a function that returns array by value, which makes the assignment operation non-working.

Nested vs outer 'foreach' variables conflict  

Reports the variables that are used as a key or value both by the inner and outer foreach loops.

Non-strict object equality  

Reports the usages of the comparison operator (==) for comparing object variables.

Optional before required parameter  

Reports the optional parameters that appear before the required parameters in a function/method declaration.

Pass parameter by reference  

Reports the arguments in a function/method call that cannot be passed by reference.

Private method may be inaccessible during late static binding call  

Reports the late static binding method calls (that is, performed via static::) that may be resolved to inaccessible private methods from child classes.

Redeclaration of standard library function  

Reports the redeclaration of standard library functions.

Redundant assignment  

Reports the assignment statements, in which both sides are equal.

Some enum cases are uncovered  

Reports the match expressions that don't cover all enum cases in match arm conditions.

Statement has empty body  

Reports the statements that have empty bodies.

Strict comparison of operands with incompatible types  

Reports the === or !== strict comparisons used on operands with incompatible types.

Suspicious names combination  

Reports the assignments and function calls where the name of the variable or parameter probably doesn't match the name of the assigned or passed value.

Switch statement without default branch  

Reports the switch statements without a default branch.

Unnecessary statement use  

Reports the use statements that contain non-fully qualified class names and thus have no effect.

Unused 'match' condition  

Reports the conditions in match expressions that will never be matched.

Unused 'switch' branch  

Reports the branches in switch statements that do not belong to the set of enum cases and as a result are never executed.

Wrong string concatenation  

Reports the attempts to concatenate strings by using the + operator instead of the dot (.) concatenation operator.

Last modified: 18 June 2024