---
title: "lint/refactor/prefer-attribute-over-annotation"
pagination: false
---

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

<RuleId id="lint/refactor/prefer-attribute-over-annotation" />

Not in any set. Unsafe fix: it can change behaviour.

## What it does

Replace configured PHPDoc annotations (including nested ones) with attributes.

## Configuration

```toml title="pun.toml"
[lint.rules]
"refactor/prefer-attribute-over-annotation" = "error"
```

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

## Replaces

- [`AnnotationToAttribute`](https://getrector.com/rule-detail/annotation-to-attribute-rector) (rector)

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