PHPCSStandards / PHPCSUtils

A suite of utility functions for use with PHP_CodeSniffer
https://phpcsutils.com/
GNU Lesser General Public License v3.0
53 stars 7 forks source link

PHP 8.4: updates for exit as function call #618

Closed jrfnl closed 4 weeks ago

jrfnl commented 1 month ago

PHP 8.4 | Collections::functionCallTokens(): add T_EXIT

As of PHP 8.4, exit and die will become "special" function calls and when used as a constant, it will be transformed to a function call at compile time. See the RFC for full details.

With this in mind, it is appropriate to add T_EXIT to the functionCallTokens() and by inheritance to the parameterPassingTokens().

Includes unit tests.

Ref: https://wiki.php.net/rfc/exit-as-function

PassedParameters: minor update for support of exit

As the Collections::parameterPassingTokens() array now contains T_EXIT, exit and die will now also be analyzable via the methods in the PassedParameters class.

This commit: