PhpStorm 2021.1 Help

Code Inspection: Method __toString implementation

Reports the attempts to convert the objects having no __toString method implementation to string.

In PHP 5.2.0 and later, such attempts will cause E_RECOVERABLE_ERROR. See __toString (php.net) for details.

If the Check __toString exists for each expression type option is enabled, the inspection will check all possible types of the expression and report if at least one ot them doesn't contain the __toString method implementation.

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 16 July 2021