Inspectopedia 2024.3 Help

Probable bugs

'var_export' or 'print_r' call is used without 'return' argument   New in this release

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

Assignment in condition   New in this release

Reports the assignments that are used in conditional expressions.

Case with specified value not found in enum   New in this release

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

Concatenation with arithmetic usage   New in this release

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

Constant reassignment   New in this release

Reports reassignments of constants.

Division by zero  

Reports division by zero or modulo by zero.

Duplicate arm in 'match' expression   New in this release

Reports duplicate bodies in match arms.

Duplicate array keys   New in this release

Reports duplicate keys in array declarations.

Duplicate branch in switch statement   New in this release

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

Duplicate case in switch statement   New in this release

Reports duplicate case expressions in switch statements.

Duplicate character in function call   New in this release

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

Duplicate condition   New in this release

Reports duplicate conditions in match expressions.

Empty index operator not supported for strings   New in this release

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

Expression result unused   New in this release

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

Field reference does not match object shape   New in this release

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   New in this release

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   New in this release

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   New in this release

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

Invalid function result used   New in this release

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

Invalid string offset usage   New in this release

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

Invalid type of unpacked argument   New in this release

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

Local object is used only for writing properties   New in this release

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

Method '__toString' implementation   New in this release

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

Method '__toString' return type   New in this release

Reports the __toString methods that do not return string.

Misordered 'rand' function arguments   New in this release

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

Missing 'break' statement   New in this release

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

Missing parent call for constructor   New in this release

Reports the constructors that do not call their parent constructor.

Missing parent call for magic methods   New in this release

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

Missing parent call for method   New in this release

Reports the methods that do not call their parent method.

Modification of the array returned from function by value won't have any effect   New in this release

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

Nested vs outer 'foreach' variables conflict   New in this release

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

Non-strict object equality   New in this release

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

Optional before required parameter   New in this release

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

Pass parameter by reference   New in this release

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

Private method may be inaccessible during late static binding call   New in this release

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   New in this release

Reports the redeclaration of standard library functions.

Redundant assignment   New in this release

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

Some enum cases are uncovered   New in this release

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

Statement has empty body   New in this release

Reports the statements that have empty bodies.

Strict comparison of operands with incompatible types   New in this release

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

Suspicious names combination   New in this release

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   New in this release

Reports the switch statements without a default branch.

Unnecessary statement use   New in this release

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

Unused 'match' condition   New in this release

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

Unused 'switch' branch   New in this release

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   New in this release

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

Last modified: 11 September 2024