From 61bcaa53abe84400a4a35884475bfb47ea6d2314 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 27 Oct 2022 17:02:55 +0200 Subject: [PATCH] WPCS-Extra: enable the `Generic.CodeAnalysis.UnusedFunctionParameter` sniff The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/382#discussion_r29981655, also see https://github.com/WordPress/WordPress-Coding-Standards/pull/382/commits/522b35f3ebac915d6eebb92624fc703c193aee60 To this end, I've send in a [PR upstream](https://github.com/squizlabs/PHP_CodeSniffer/pull/1318) to address these concerns, which has subsequently been merged. The adjusted version of the sniff was released in PHPCS 3.4.0, which means the sniff can now be added. Note: the sniff has since then also been adjusted to handle arrow functions correctly, as well as constructor property promotion. Fixes 1510 --- WordPress-Extra/ruleset.xml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/WordPress-Extra/ruleset.xml b/WordPress-Extra/ruleset.xml index 3c33ad3111..f2616291b7 100644 --- a/WordPress-Extra/ruleset.xml +++ b/WordPress-Extra/ruleset.xml @@ -48,13 +48,23 @@ - - - + + + + + + + + + + + +