Inspectopedia Help

Code smell

Name

Language

'__toString' may throw an exception  

PHP

'array_push()' with single element  

PHP

'array_search()' can be replaced with 'in_array()' call  

PHP

'continue' is targeting 'switch' statement  

PHP

'func_get_arg()' call can be replaced with parameter access  

PHP

'if' can be merged with subsequent condition  

PHP

'in_array' can be replaced with comparison  

PHP

'match' expression has only default arm and should be simplified  

PHP

'preg_match' can be replaced with 'str_contains'  

PHP

'preg_match()' can be replaced with comparison  

PHP

'preg_replace()' can be replaced with '(l|r)trim' call  

PHP

'preg_split' can be replaced with 'explode'  

PHP

'switch' with single 'case'  

PHP

Accessing static trait members  

PHP

Argument of 'instanceof' should be only objects or strings  

PHP

Array access can be replaced with 'foreach' value  

PHP

Array internal pointer reset is unnecessary  

PHP

Array is always empty at the point of access  

PHP

Array to string conversion  

PHP

Array used only with write access  

PHP

Boolean expression can be simplified  

PHP

Class constant referenced via child class  

PHP

Concatenation to empty string can be merged with assignment  

PHP

Condition can be replaced with 'min()'/'max()' call  

PHP

Constant name defined with a leading slash  

PHP

Duplicate branch in 'catch' statement  

PHP

Duplicate operand in comparison  

PHP

Exception is immediately rethrown  

PHP

Foreach over array literal with single element  

PHP

Format function call with single argument  

PHP

Idempotent operation in binary expression  

PHP

Inconsistent return points  

PHP

Logical expression has same operands  

PHP

Loop can be replaced with 'implode()'  

PHP

Loop can be replaced with 'in_array()' or 'array_key_exists()' call  

PHP

Loop can be replaced with 'str_repeat'  

PHP

Method visibility should not be overridden  

PHP

Method's return value is never used  

PHP

Modulo operation with '1' as operand  

PHP

Nested 'dirname()' call can be replaced with 'levels' parameter usage  

PHP

Nested 'min/max' call  

PHP

Parameter's value is always the same  

PHP

Parameters number mismatch declaration  

PHP

Pointless boolean expression inside 'if' condition  

PHP

Private property can be local  

PHP

Property usages have same access  

PHP

Redundant 'array_values' call on a value iterated in 'foreach'  

PHP

Redundant 'continue/break' argument  

PHP

Redundant 'static' in final class  

PHP

Redundant assignment to promoted property  

PHP

Redundant cast to boolean  

PHP

Redundant cast to string  

PHP

Redundant closure '.*'  

PHP

Redundant method override  

PHP

Redundant optional argument  

PHP

Ternary expression can be replaced with condition  

PHP

Ternary expression can be replaced with short version  

PHP

Too many parameters in function declaration  

PHP

Unnecessary 'return/continue' statement  

PHP

Unnecessary local variable  

PHP

Unnecessary pass-by-ref  

PHP

Unnecessary semicolon  

PHP

Unnecessary spread operator for function call argument  

PHP

Usage of a silence operator  

PHP

Useless trailing comma  

PHP

Using 'count()' as index for appending value to array  

PHP

Last modified: 13 July 2023