A PHP internals mailing list thread discussing the proposed Primary Constructors RFC for PHP. The RFC proposes a new syntax allowing class properties to be declared directly in the class signature (e.g., `class Money(public readonly int $amount) {}`), saving a few lines over constructor promotion. Key debate centers on whether primary constructors should support a body: the RFC author (Rob Landers) argues bodies are intentionally excluded and that 30-70% of real-world constructors could already benefit from the bodyless form; critics (Nick Sdot, Rowan Tommins) disagree on opposite grounds — one argues the feature is too limited without bodies, the other argues full parity would cause style debates. A broader concern raised is PHP's pattern of shipping incomplete features that never get follow-up improvements, citing stringable enums, readonly hooks, and promoted property set hooks as examples.

38m read timeFrom externals.io
Post cover image
103 Impressions