Skip to content

Instantly share code, notes, and snippets.

@jrfnl
Last active July 15, 2026 22:07
Show Gist options
  • Select an option

  • Save jrfnl/f7ad1aad5842187e44c16be2f34ad9eb to your computer and use it in GitHub Desktop.

Select an option

Save jrfnl/f7ad1aad5842187e44c16be2f34ad9eb to your computer and use it in GitHub Desktop.
Impact analysis proposed PHP 8.6 deprecation of "_" as constant identifier and alias on Packagist top 4000
The results of checking for "Deprecate using "_" as a constant and compile time alias" and
"Deprecate using "_" as a function name and the _() function alias for gettext()" are a little entangled.
The check & results in this gist should be reviewed in conjunction with gist https://gist.github.com/jrfnl/bf2b5fb4ef1f836db2d8d84ee4828dc2
<?xml version="1.0"?>
<ruleset name="Impact check for https://wiki.php.net/rfc/deprecations_php_8_6">
<!-- This ruleset should only be used in conjunction with PHPCompatibility at commit
https://github.com/PHPCompatibility/PHPCompatibility/commit/cc67a3824dda9612896f5892c2d6d9408fa20d77 -->
<file>sources</file>
<arg name="extensions" value="php"/>
<arg value="ps"/>
<arg name="basepath" value="./sources/"/>
<arg name="parallel" value="8"/>
<arg name="no-colors"/>
<arg name="ignore-annotations"/>
<arg name="report" value="code,summary,source"/>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<!-- We are specifically and only checking for the PHP 8.6 deprecation(s). -->
<config name="testVersion" value="8.6"/>
<!-- <rule ref="PHPCompatibility.Keywords.ForbiddenClassAlias._Found"/> -->
<rule ref="PHPCompatibility.Keywords.ForbiddenNames._Found"/>
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
<rule ref="Internal.LineEndings.Mixed">
<severity>0</severity>
</rule>
</ruleset>
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
----------------------------------------------------------------------
SOURCE COUNT
----------------------------------------------------------------------
PHPCompatibility.Keywords.ForbiddenNames._Found 12
----------------------------------------------------------------------
A TOTAL OF 12 SNIFF VIOLATIONS WERE FOUND IN 1 SOURCE
----------------------------------------------------------------------
PHP CODE SNIFFER REPORT SUMMARY
---------------------------------------------------------------------------------------------------------------------------
FILE ERRORS WARNINGS
---------------------------------------------------------------------------------------------------------------------------
ajthinking\archetype--v2.0.0\src\snippets\relationships.php 1 0
jetbrains\phpstorm-stubs--v2026.1\gettext\gettext.php 1 0
johnpbloch\wordpress-core--7.0.0\wp-includes\compat.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\Parser.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\ParseRelationshipDataTrait.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsCollection.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsIdentifier.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsNull.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsResource.php 1 0
laravel-json-api\neomerx-json-api--v5.0.3\src\Schema\SchemaContainer.php 1 0
phpstan\php-8-stubs--0.4.36\stubs\ext\gettext\_.php 1 0
roots\wordpress-no-content--7.0\wp-includes\compat.php 1 0
---------------------------------------------------------------------------------------------------------------------------
A TOTAL OF 12 ERRORS AND 0 WARNINGS WERE FOUND IN 12 FILES
---------------------------------------------------------------------------------------------------------------------------
FILE: ajthinking\archetype--v2.0.0\src\snippets\relationships.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 12: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
10: * This is just a placeholder class where we can add our snippets
11: */
>> 12: class _ extends FakeName
13: {
14: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: jetbrains\phpstorm-stubs--v2026.1\gettext\gettext.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 29: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
27: */
28: #[Pure]
>> 29: function _(string $message): string {}
30:
31: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: johnpbloch\wordpress-core--7.0.0\wp-includes\compat.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 26: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
24: * @return string
25: */
>> 26: function _( $message ) {
27: return $message;
28: }
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\Parser.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 35: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
33: use Neomerx\JsonApi\Exceptions\InvalidArgumentException;
34: use Traversable;
>> 35: use function Neomerx\JsonApi\I18n\format as _;
36:
37: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\ParseRelationshipDataTrait.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 32: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
30: use Neomerx\JsonApi\Parser\IdentifierAndResource;
31: use Traversable;
>> 32: use function Neomerx\JsonApi\I18n\format as _;
33:
34: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsCollection.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 30: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
28: use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
29: use Neomerx\JsonApi\Exceptions\LogicException;
>> 30: use function Neomerx\JsonApi\I18n\format as _;
31:
32: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsIdentifier.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 30: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
28: use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
29: use Neomerx\JsonApi\Exceptions\LogicException;
>> 30: use function Neomerx\JsonApi\I18n\format as _;
31:
32: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsNull.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 25: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
23: use Neomerx\JsonApi\Contracts\Parser\ResourceInterface;
24: use Neomerx\JsonApi\Exceptions\LogicException;
>> 25: use function Neomerx\JsonApi\I18n\format as _;
26:
27: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Parser\RelationshipData\RelationshipDataIsResource.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 29: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
27: use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
28: use Neomerx\JsonApi\Exceptions\LogicException;
>> 29: use function Neomerx\JsonApi\I18n\format as _;
30:
31: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: laravel-json-api\neomerx-json-api--v5.0.3\src\Schema\SchemaContainer.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 26: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
24: use Neomerx\JsonApi\Contracts\Schema\SchemaInterface;
25: use Neomerx\JsonApi\Exceptions\InvalidArgumentException;
>> 26: use function Neomerx\JsonApi\I18n\format as _;
27:
28: /**
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: phpstan\php-8-stubs--0.4.36\stubs\ext\gettext\_.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 4: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
2:
3: /** @alias gettext */
>> 4: function _(string $message): string
5: {
6: }
------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: roots\wordpress-no-content--7.0\wp-includes\compat.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------
LINE 26: ERROR Function name, class name, namespace name or constant name can not be reserved keyword '_' (since version 8.6)
(PHPCompatibility.Keywords.ForbiddenNames._Found)
------------------------------------------------------------------------------------------------------------------------------------------------------
24: * @return string
25: */
>> 26: function _( $message ) {
27: return $message;
28: }
------------------------------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment