1515use WordPressCS \WordPress \AbstractFunctionParameterSniff ;
1616
1717/**
18- * This checks the enqueued 4th and 5th parameters to make sure the version and in_footer are set.
18+ * This checks that the 4th ($ver) parameter is set for all enqueued resources and that the 5th ($in_footer) parameter
19+ * is set for wp_register_script() and wp_enqueue_script().
1920 *
2021 * If a source ($src) value is passed, then version ($ver) needs to have non-falsy value.
21- * If a source ($src) value is passed a check for in footer ($in_footer), warn the user if the value is falsy .
22+ * If a source ($src) value is passed, then it is recommended to explicitly set the $in_footer parameter .
2223 *
2324 * @link https://developer.wordpress.org/reference/functions/wp_register_script/
2425 * @link https://developer.wordpress.org/reference/functions/wp_enqueue_script/
@@ -66,7 +67,7 @@ final class EnqueuedResourceParametersSniff extends AbstractFunctionParameterSni
6667 /**
6768 * Token codes which are "safe" to accept to determine whether a version would evaluate to `false`.
6869 *
69- * This array is enriched with the several of the PHPCS token arrays in the register() method.
70+ * This array is enriched with several of the PHPCS token arrays in the register() method.
7071 *
7172 * @var array<int|string, int|string>
7273 */
@@ -88,7 +89,8 @@ final class EnqueuedResourceParametersSniff extends AbstractFunctionParameterSni
8889 /**
8990 * Returns an array of tokens this test wants to listen for.
9091 *
91- * Overloads and calls the parent method to allow for adding additional tokens to the $safe_tokens property.
92+ * Overloads and calls the parent method to allow for adding additional tokens to the
93+ * $false_tokens and $safe_tokens properties.
9294 *
9395 * @return array
9496 */
@@ -165,8 +167,8 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p
165167 /*
166168 * In footer Check
167169 *
168- * Check to make sure that $in_footer is set to true .
169- * It will warn the user to make sure it is intended .
170+ * Check to make sure that $in_footer is explicitly set .
171+ * Warn the user if it is not set .
170172 *
171173 * Only wp_register_script and wp_enqueue_script need this check,
172174 * as this parameter is not available to wp_register_style and wp_enqueue_style.
0 commit comments