Inspectopedia Help

Type compatibility

'null' is not compatible with parameter's declared type   New in this release

Reports the variables that are initialised via passing them by reference to a parameter incompatible with null.

Arithmetic operation with unsupported operands   New in this release

Reports arithmetic and bitwise expressions with unsupported operands.

Array offset access on illegal type   New in this release

Reports the array offset access expressions that are used on illegal types.

Class constant type is missing   New in this release

In PHP 8.3 and later, reports a class constant that is missing a type declaration.

Illegal array key type   New in this release

Reports the array keys that are of illegal type, such as objects or arrays.

Illegal string offset   New in this release

Reports the usages of non-integer offsets in string access expressions such as $str[42].

Incompatible return type   New in this release

Reports the return statements whose return value type is not compatible with the one declared for a function/method.

Invalid argument supplied for 'foreach()'   New in this release

Reports the foreach constructs used on variables of the string, float, int, or boolean type.

Missing parameter's type declaration   New in this release

Reports the parameters that have no type declaration specified.

Missing property's type declaration   New in this release

Reports the properties that have no type declaration.

Missing return type declaration   New in this release

Reports the functions that have no return type declaration specified.

Missing strict types declaration   New in this release

Detects the missing declare(strict_types=1) directive in the file.

Parameter type   New in this release

Reports the parameters passed to a function call, whose types do not match the ones specified in the function definition via type declaration or the PHPDoc @param tag.

Redundant intersection type   New in this release

Reports the intersection type declarations that contain redundant types, for example, an intersection type that contains both the parent class and its subclass.

Strict type checking rules violation   New in this release

Reports violations of the strict type checking rules.

Type declaration is redundant and could be simplified   New in this release

Reports union type declarations that contain redundant types, for example, a union type that contains both the class alias and the original class.

Type mismatch in property assignment   New in this release

Reports type violations in properties assignments.

Last modified: 11 September 2024