---
title: "lint/classes/add-stringable"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/classes/add-stringable" />

In the [`modernize`](/docs/rules/sets/modernize) set. Safe fix.

## What it does

A class that implements the `__toString()` method must explicitly implement the `Stringable` interface.

## Configuration

```toml title="pun.toml"
[lint.rules]
"classes/add-stringable" = "error"
```

To skip it in some files, add an [override](/docs/configuration/pun-toml#lint) or a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Replaces

- [`stringable_for_to_string`](https://cs.symfony.com/doc/rules/class_notation/stringable_for_to_string.html) (php-cs-fixer)

[More lint/classes rules](/docs/rules/lint/classes) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
