Skip to content

Commit 074494e

Browse files
rodrigoprimojrfnl
andcommitted
Apply suggestions from code review
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
1 parent b47a679 commit 074494e

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

WordPress/Helpers/WPDBTrait.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,23 @@
2323
trait WPDBTrait {
2424

2525
/**
26-
* Checks whether this is a call to a $wpdb method.
26+
* Checks whether this is a call to one of a specific group of $wpdb method(s).
2727
*
2828
* Supports both instance method calls (e.g., `$wpdb->prepare()`) and static
2929
* method calls (e.g., `wpdb::esc_like()`).
3030
*
3131
* Note: Static calls to wpdb methods trigger a deprecation notice in PHP 7.0+
32-
* and result in a fatal error in PHP 8.0+ as wpdb methods are not declared static.
32+
* and result in a fatal error in PHP 8.0+ as wpdb methods are not declared static,
33+
* but that's not our concern.
3334
*
34-
* If available in the class using this trait, the following properties are automatically set:
35-
* - $methodPtr: Stack pointer to the method name.
36-
* - $i: Stack pointer to the opening parenthesis of the method call.
37-
* - $end: Stack pointer to the comma after the first parameter, or to one
38-
* past the last token of the first parameter if there is no comma.
35+
* If the following properties are explicitly declared in the class using this trait,
36+
* they will be automatically set:
37+
* - `$methodPtr`: Stack pointer to the method name.
38+
* - `$i`: Stack pointer to the opening parenthesis of the method call.
39+
* - `$end`: Stack pointer to the comma after the first parameter, or to the
40+
* token directly after the first parameter if there is no comma.
3941
*
40-
* The $methodPtr and $i properties may be set even when this method returns false
42+
* The `$methodPtr` and `$i` properties may be set even when this method returns `false`
4143
* (e.g., for property access like `$wpdb->show_errors`).
4244
*
4345
* @since 0.8.0
@@ -51,7 +53,7 @@ trait WPDBTrait {
5153
* for properties in the sniff class(es) using it.}}
5254
*
5355
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
54-
* @param int $stackPtr The index of the $wpdb variable or wpdb class name token.
56+
* @param int $stackPtr The index of the $wpdb variable or wpdb (class) name token.
5557
* @param array $target_methods Array of methods. Key(s) should be method name
5658
* in lowercase.
5759
*

0 commit comments

Comments
 (0)