PHP 8.3 | :sparkles: New `PHPCompatibility.ParameterValues.NewClassAliasInternalClass` sniff by jrfnl · Pull Request #1951 · PHPCompatibility/PHPCompatibility
…alClass` sniff
> . class_alias() now supports creating an alias of an internal class.
This commit introduces a new sniff which does best-effort detection for calls to the `class_alias()` function where the class being aliased is a PHP native class.
Mind:
* If a PHP native class is being aliased, but that class does not exist in the PHP version on which PHPCS is being run, the sniff will stay silent (false negative).
* If a PHP native class is being aliased, but the extension which declares the class is not loaded for the PHP environment on which PHPCS is being run, the sniff will stay silent (false negative).
Future scope:
* The sniff currently does not handle `class_alias()` class with the class being aliased in the following format: `ClassName::class`.
Once the namespace and use statement trackers are available in PHPCSUtils, handling of that syntax should be added to the sniff.
Includes tests.
Includes documentation.
Ref:
* https://github.com/php/php-src/blob/ed9529a7d3c1f5dfbf16c2d388d944af8ec86a76/UPGRADING#L248
* php/php-src 9826
* php/php-src 10483
* php/php-src@821fc55
Related to 1589
wimg approved these changes Oct 27, 2025
wimg
deleted the
php-8.3/new-newclassaliasinternalclass-sniff
branch
jrfnl
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters