---
title: "format/phpdoc/return-self-reference"
pagination: false
---

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

<RuleId id="format/phpdoc/return-self-reference" />

Not in any preset. Safe fix.

## What it does

The type of `@return` annotations of methods returning a reference to itself must the configured one.

## Configuration

```toml title="pun.toml"
[format.rules]
"phpdoc/return-self-reference" = 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 |
| --- | --- | --- | --- | --- |
| `replacements` | `map` | Any | `{ "this" = "$this", "@this" = "$this", "$self" = "self", "@self" = "self", "$static" = "static", "@static" = "static" }` | `replacements` |

## Replaces

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

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