phpstan-deprecation-rules
                                
                                 phpstan-deprecation-rules copied to clipboard
                                
                                    phpstan-deprecation-rules copied to clipboard
                            
                            
                            
                        support deprecated magic __toString() in echo statement
with this change phpstan is able to detect cases, where object values are used in echo statements and implicitly call a magic and deprecated __toString method.
In case this new rule gets accepted, I would be willing to implement the same for the print statement.
refs https://github.com/phpstan/phpstan/issues/4899