---
title: "lint/php-8.6/prefer-readonly-property-default"
pagination: false
---

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

<RuleId id="lint/php-8.6/prefer-readonly-property-default" />

In the [`modernize`](/docs/rules/sets/modernize) set. Unsafe fix: it can change behaviour. Gated by php-8.6. **Planned: not in Pun yet.** Enabling it is a config error.

## What it does

Move a constant constructor assignment of a readonly property to a property default value

## Replaces

- [`ConstructorReadonlyAssignToDefault`](https://getrector.com/rule-detail/constructor-readonly-assign-to-default-rector) (rector)

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