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

Proposal: allow inline anon functions in hooks' callbacks #54

Open
slaFFik opened this issue May 2, 2024 · 0 comments
Open

Proposal: allow inline anon functions in hooks' callbacks #54

slaFFik opened this issue May 2, 2024 · 0 comments

Comments

@slaFFik
Copy link
Member

slaFFik commented May 2, 2024

Expected Behavior

Silence those 3 warnings listed below when used within add_action() and add_filter() context.

Current Behavior

When you have a code like this:

add_action( 'admin_init', static function() {

	( new Admin() )->init();
} );

you receive these warnings for the 1st line:

  • PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket
  • PEAR.Functions.FunctionCallSignature.MultipleArguments

and this one for the last line:

  • PEAR.Functions.FunctionCallSignature.CloseBracketLine

Otherwise, this thing needs to be done which looks kinda ugly and excessive:

add_action( 
	'admin_init', 
	static function() {

		( new Admin() )->init();
	}
);

Screenshots

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant