Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.0 | ✨ New PHPCompatibility.ParameterValues.ForbiddenGetClassNoArgsOutsideOO sniff #1602

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 4, 2023

8.0.0 Calling this function from outside a class, without any arguments, will now throw an Error.
Previously, an E_WARNING was raised and the function returned false.

Applies to both get_class() as well as get_called_class().

Refs:

This adds a new sniff to detect the above, which wasn't mentioned in the PHP 8.0 generic changelog nor in the migration guide, though a note about it can be found on the functions manual pages.

Includes tests and documentation.

Related to #809

…ArgsOutsideOO` sniff

> 8.0.0 	Calling this function from outside a class, without any arguments, will now throw an `Error`.
>            Previously, an `E_WARNING` was raised and the function returned `false`.

Applies to both `get_class()` as well as `get_called_class()`.

Refs:
* https://www.php.net/manual/en/function.get-class.php#refsect1-function.get-class-changelog
* php/php-src@213b666
* https://3v4l.org/f05rn
* https://3v4l.org/a7h7r

This adds a new sniff to detect the above, which wasn't mentioned in the PHP 8.0 generic changelog nor in the migration guide, though a note about it can be found on the functions manual pages.

Includes tests and documentation.

Related to 809
@jrfnl jrfnl added this to the 10.0.0 milestone Aug 4, 2023
@jrfnl jrfnl requested a review from wimg August 4, 2023 22:15
@wimg wimg merged commit 82e3334 into develop Aug 10, 2023
43 checks passed
@wimg wimg deleted the php-8.0/new-forbiddengetclassnoargsoutsideoo-sniff branch August 10, 2023 19:01
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.

None yet

2 participants