Code Inspection: Array write access is not used
Reports the array write access expressions that are not used in code afterwards. The most common source of such problems is modifying an array passed via a parameter: if an array is passed by value, the change will not be visible outside the function.
In the following example, the modifyArray()
function is intended to modify the array passed as a parameter. Initially, the $myArr
array parameter is passed by value, so modifying it will not have any effect outside the function. After the quick-fix is applied, the reference sign &
is added to the parameter in the function declaration, which means that the array parameter is passed by reference and will therefore be modified is intended.
Suppress an inspection in the editor
Position the caret at the highlighted line and press Alt+Enter or click .
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.