---
title: "lint/phpdoc/no-misplaced"
pagination: false
---

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

<RuleId id="lint/phpdoc/no-misplaced" />

In the [`coding-style`](/docs/rules/sets/coding-style) set. Safe fix.

## What it does

Docblocks should only be used on structural elements.

## Configuration

```toml title="pun.toml"
[lint.rules]
"phpdoc/no-misplaced" = "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.

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `allow-before-return-statement` | `bool` | Any | `false` | `allow_before_return_statement` |
| `ignored-tags` | `list` | Any | `[]` | `ignored_tags` |

## Replaces

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

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