---
title: "format/strings/implicit-backslashes"
pagination: false
---

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

<RuleId id="format/strings/implicit-backslashes" />

Not in any preset. Safe fix.

## What it does

Handles implicit backslashes in strings and heredocs. Depending on the chosen strategy, it can escape implicit backslashes to ease the understanding of which are special chars interpreted by PHP and which not (`escape`), or it can remove these additional backslashes if you find them superfluous (`unescape`). You can also leave them as-is using `ignore` strategy.

## Configuration

```toml title="pun.toml"
[format.rules]
"strings/implicit-backslashes" = true
```

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

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `double-quoted` | `enum` | `escape`, `unescape`, `ignore` | `"escape"` | `double_quoted` |
| `heredoc` | `enum` | `escape`, `unescape`, `ignore` | `"escape"` | `heredoc` |
| `single-quoted` | `enum` | `escape`, `unescape`, `ignore` | `"unescape"` | `single_quoted` |

## Replaces

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

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