Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 6, 2025

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/PHPCSUtils supports this).

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

Includes tests.
Includes documentation.

Refs:

Related to #1731

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 force-pushed the php-8.4/new-final-properties-sniff branch from 65e07f0 to 70b6b30 Compare July 7, 2025 23:05
@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 merged commit 5dc0050 into develop Aug 6, 2025
47 checks passed
@wimg wimg deleted the php-8.4/new-final-properties-sniff branch August 6, 2025 19:27
@jrfnl jrfnl added the PHP: 8.4 label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants