PHP 8.4 | :sparkles: New `PHPCompatibility.Classes.NewFinalProperties` sniff (RFC) by jrfnl · Pull Request #1815 · PHPCompatibility/PHPCompatibility

@jrfnl jrfnl mentioned this pull request

Jul 6, 2025

58 tasks

@jrfnl

As of PHP 8.4, properties can be declared as `final`.

Note: the `final` keyword is not (yet) supported for constructor promoted properties. Support for this will be added in PHP 8.5 (and the sniff will need to be updated once PHPCS supports this).

This commit adds a new sniff to detect final properties as supported in PHP 8.4.

Includes tests.
Includes documentation.

Refs:
* https://wiki.php.net/rfc/property-hooks#final_hooks
* php/php-src 13455
* php/php-src@780a828

@jrfnl jrfnl changed the title PHP 8.4 | ✨ New PHPCompatibility.Classes.NewFinalProperties sniff PHP 8.4 | ✨ New PHPCompatibility.Classes.NewFinalProperties sniff (RFC)

Jul 11, 2025

wimg

wimg approved these changes Aug 6, 2025

@wimg wimg deleted the php-8.4/new-final-properties-sniff branch

August 6, 2025 19:27

@jrfnl jrfnl mentioned this pull request

Sep 1, 2025