Inspectopedia Help

Invalid string offset usage

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

The following usages are reported:

  • Using string offsets as objects or arrays

  • Unsetting string offsets via unset

  • Passing string offsets by reference

  • Creating references to or from string offsets

  • Incrementing or decrementing string offsets

  • Using combined operator assignments such as += or .= on string offsets

  • Assigning string offsets with empty strings or strings with length >1

Inspection Details

Available in:

PhpStorm 2023.3, Qodana for PHP 2023.3



Last modified: 13 July 2023