PhpStorm
 
Get PhpStorm
You are viewing the documentation for an earlier version of PhpStorm.

Code Inspection: Unused assignment

Last modified: 13 May 2022

Reports a variable whose value is never used after assignment.

Suggests removing the unused variable to shorten the code and to avoid redundant allocations.

The following cases are reported:

  • A variable is never read after assignment.

  • The value of a variable is always overwritten with another assignment before the variable is read next time.

  • The initializer of a variable is redundant (for one of the above-mentioned reasons).