← Back to all briefings

Developer · Credibility 86/100 · · 1 min read

Runtime Briefing — PHP 8.2 Introduces Readonly Classes

PHP 8.2.0 went GA on 8 December 2022 with readonly classes, standalone true/false/null types, and dynamic property deprecation, requiring application teams to validate language changes and extension support.

Executive briefing: The PHP project released PHP 8.2.0 on , continuing rapid language evolution focused on stronger typing and developer ergonomics.

Feature highlights

  • Readonly classes. Entire classes can now be declared readonly, locking down properties for domain models.
  • Standalone types. true, false, and null may be used as dedicated type declarations, improving API contracts.
  • SensitiveParameter attribute. Built-in attribute redacts secrets from stack traces and logs.
  • Dynamic property deprecation. Accessing undeclared properties triggers deprecation notices ahead of PHP 9 removals.

Adoption steps

  • Update Composer constraints and ensure framework dependencies (Laravel, Symfony, WordPress) publish PHP 8.2-compatible releases.
  • Run application test suites with error_reporting=E_ALL to uncover dynamic property usage that must be refactored.
  • Enable the SensitiveParameter attribute for logging middleware handling credentials or tokens.
  • PHP 8.2
  • Language release
  • Runtime upgrade
Back to curated briefings