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.1 | PassedParameters::hasParameters(): prevent false positives for first class callable declarations #362

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 15, 2022

PHP 8.1 introduced a new callback declaration syntax, called "first class callables". This syntax can be easily confused with a function call.

While it remains the responsibility of individual sniffs to verify if something is a function call before passing it to any of the PassedParameters methods, a little defensive coding to prevent incorrect results goes a long way.

Includes tests.

Refs:

…for first class callable declarations

PHP 8.1 introduced a new callback declaration syntax, called "first class callables".
This syntax can be easily confused with a function call.

While it remains the responsibility of individual sniffs to verify if something is a function call before passing it to any of the `PassedParameters` methods, a little defensive coding to prevent incorrect results goes a long way.

Includes tests.

Refs:
* https://wiki.php.net/rfc/first_class_callable_syntax
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Oct 15, 2022
@jrfnl jrfnl merged commit 7472c96 into develop Oct 15, 2022
@jrfnl jrfnl deleted the php-8.1/passedparams-prevent-false-pos-first-class-callables branch October 15, 2022 06: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

1 participant