<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ji44xhk9o" -->

---
title: Readonly Property Defaults in PHP 8.6: A Four-Year-Old...
description: PHP 8.6 removes the compile-time restriction that prevented readonly properties from declaring default values, a rule that has stood since readonly properties...
canonical: https://daily.dev/posts/ji44xhk9o
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Readonly Property Defaults in PHP 8.6: A Four-Year-Old Restriction Finally Lifts | daily.dev
og:description: PHP 8.6 removes the compile-time restriction that prevented readonly properties from declaring default values, a rule that has stood since readonly properties...
og:url: https://daily.dev/posts/ji44xhk9o
og:image: https://api.daily.dev/og/posts/ji44Xhk9o.png
og:image:alt: Post cover image
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Readonly Property Defaults in PHP 8.6: A Four-Year-Old Restriction Finally Lifts

**[PHP Dev](https://daily.dev/sources/phpdev)** · [@damienseguy](https://daily.dev/damienseguy) · 12 upvotes · 2 comments

## Summary

PHP 8.6 removes the compile-time restriction that prevented readonly properties from declaring default values, a rule that has stood since readonly properties shipped in PHP 8.1. The Readonly Property Defaults RFC by Nick Sdot passed with 24 yes votes and was merged into php-src, targeting the November 19, 2026 PHP 8.6 release. The change becomes meaningful mainly because PHP 8.4 introduced interface properties, which class constants and methods cannot satisfy, forcing boilerplate constructors just to hardcode a fixed value. The piece walks through the motivating interface/blueprint pattern and a set of edge cases: defaults still count as the initializing write (so constructor reassignment still fails), interfaces still distinguish get from set, inheritance and cloning behave normally, unset() and lazy __get() no longer trigger, serialization includes the default, asymmetric visibility doesn't create a loophole, and trait composition still requires matching defaults. No BC break or migration is required; the main ecosystem impact is IDEs, language servers, and static analysers needing updates to stop flagging the now-legal syntax.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://shocm.me/posts/2026-08-30-php-86-readonly-property-defaults>

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 1 upvotes

> I'd version any cache payload that includes a readonly default. Old serialized objects keep the previous value even after the code changes.

## Similar posts on daily.dev

- [\[RFC\] Readonly Property Defaults](https://daily.dev/posts/rfc-readonly-property-defaults-wdsrbpxad) · externals.io · 0 upvotes · 0 comments
- [What's new in PHP 8.6](https://daily.dev/posts/what-s-new-in-php-8-6-eixar55ou) · stitcher.io · 103 upvotes · 7 comments
- [Immutability in PHP Beyond readonly](https://daily.dev/posts/immutability-in-php-beyond-readonly-e2zuz4sl6) · W endell Adriel · 13 upvotes · 1 comments
- [\[php-src\] PR \#20903: GH-10497 \(const obj->prop write\)](https://daily.dev/posts/php-src-pr-20903-gh-10497-const-obj--prop-write--1ouy4eieo) · externals.io · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/ji44xhk9o)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/ji44xhk9o","headline":"Readonly Property Defaults in PHP 8.6: A Four-Year-Old Restriction Finally Lifts","text":"Shared: Readonly Property Defaults in PHP 8.6: A Four-Year-Old Restriction Finally Lifts","url":"https://daily.dev/posts/ji44xhk9o","datePublished":"2026-08-30T19:26:04.306Z","dateModified":"2026-08-30T19:27:15.575Z","author":{"@type":"Person","name":"Damien seguy","url":"https://daily.dev/damienseguy","image":"https://media.daily.dev/image/upload/s--nPbjKqol--/f_auto,q_auto/v1698422671/avatars/avatar_G85JhYcDxAg024Omc8Rlp","description":"PHP developer passionate about deep language knowledge, testing, static analysis, and sustainable it","worksFor":{"@type":"Organization","name":"Exakat","logo":"https://media.daily.dev/image/upload/s--ibtl6fze--/f_auto/v1749051132/companies/exakat"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":39240}},"image":"https://media.daily.dev/image/upload/s--CxzD6vbw--/f_auto/v1722860399/public/Placeholder%2005","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":12},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"sharedContent":{"@type":"WebPage","url":"https://api.daily.dev/r/9ougBeQSB"},"comment":[{"@type":"Comment","text":"I’d version any cache payload that includes a readonly default. Old serialized objects keep the previous value even after the code changes.","datePublished":"2026-09-01T01:51:12.372Z","url":"https://daily.dev/posts/ji44Xhk9o#c-jZ2ImYRzp","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/phpdev","name":"PHP Dev"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PHP Dev","item":"https://daily.dev/squads/phpdev"},{"@type":"ListItem","position":3,"name":"Readonly Property Defaults in PHP 8.6: A Four-Year-Old Restriction Finally Lifts"}]}
```

