---
title: "lint/refactor/add-override-attribute"
pagination: false
---

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

<RuleId id="lint/refactor/add-override-attribute" />

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

## What it does

Add #[Override] to properties that override a parent class's property (PHP 8.5).

## Configuration

```toml title="pun.toml"
[lint.rules]
"refactor/add-override-attribute" = "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

- [`AddOverrideAttributeToOverriddenProperties`](https://getrector.com/rule-detail/add-override-attribute-to-overridden-properties-rector) (rector)
- [`property.missingOverride`](https://phpstan.org/error-identifiers/property.missingOverride) (phpstan)

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