| @@ -8,8 +8,15 @@ | ||
| 8 | 8 | * |
| 9 | 9 | * @since 1.2 |
| 10 | 10 | */ |
| 11 | 11 | class PLL_Walker_Dropdown extends Walker { |
| 12 | + /** | |
| 13 | + * Database fields to use. | |
| 14 | + * | |
| 15 | + * @see https://developer.wordpress.org/reference/classes/walker/#properties Walker::$db_fields. | |
| 16 | + * | |
| 17 | + * @var array | |
| 18 | + */ | |
| 12 | 19 | public $db_fields = array( 'parent' => 'parent', 'id' => 'id' ); |
| 13 | 20 | |
| 14 | 21 | /** |
| 15 | 22 | * Outputs one element |
| @@ -15,13 +22,14 @@ | ||
| 15 | 22 | * Outputs one element |
| 16 | 23 | * |
| 17 | 24 | * @since 1.2 |
| 18 | 25 | * |
| 19 | - * @param string $output Passed by reference. Used to append additional content. | |
| 20 | - * @param object $element The data object. | |
| 21 | - * @param int $depth Depth of the item. | |
| 22 | - * @param array $args An array of additional arguments. | |
| 23 | - * @param int $current_object_id ID of the current item. | |
| 26 | + * @param string $output Passed by reference. Used to append additional content. | |
| 27 | + * @param stdClass $element The data object. | |
| 28 | + * @param int $depth Depth of the item. | |
| 29 | + * @param array $args An array of additional arguments. | |
| 30 | + * @param int $current_object_id ID of the current item. | |
| 31 | + * @return void | |
| 24 | 32 | */ |
| 25 | 33 | public function start_el( &$output, $element, $depth = 0, $args = array(), $current_object_id = 0 ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 26 | 34 | $value = $args['value']; |
| 27 | 35 | $output .= sprintf( |
| @@ -37,14 +45,15 @@ | ||
| 37 | 45 | * Overrides Walker::display_element as expects an object with a parent property |
| 38 | 46 | * |
| 39 | 47 | * @since 1.2 |
| 40 | 48 | * |
| 41 | - * @param object $element Data object. | |
| 42 | - * @param array $children_elements List of elements to continue traversing. | |
| 43 | - * @param int $max_depth Max depth to traverse. | |
| 44 | - * @param int $depth Depth of current element. | |
| 45 | - * @param array $args An array of arguments. | |
| 46 | - * @param string $output Passed by reference. Used to append additional content. | |
| 49 | + * @param stdClass $element Data object. | |
| 50 | + * @param array $children_elements List of elements to continue traversing. | |
| 51 | + * @param int $max_depth Max depth to traverse. | |
| 52 | + * @param int $depth Depth of current element. | |
| 53 | + * @param array $args An array of arguments. | |
| 54 | + * @param string $output Passed by reference. Used to append additional content. | |
| 55 | + * @return void | |
| 47 | 56 | */ |
| 48 | 57 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
| 49 | 58 | $element = (object) $element; // Make sure we have an object |
| 50 | 59 | $element->parent = $element->id = 0; // Don't care about this |
| @@ -74,9 +83,9 @@ | ||
| 74 | 83 | */ |
| 75 | 84 | public function walk( $elements, $max_depth, ...$args ) { // // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility |
| 76 | 85 | $output = ''; |
| 77 | 86 | |
| 78 | - if ( is_array( $max_depth ) ) { | |
| 87 | + if ( is_array( $max_depth ) ) { // @phpstan-ignore-line | |
| 79 | 88 | // Backward compatibility with Polylang < 2.6.7 |
| 80 | 89 | if ( WP_DEBUG ) { |
| 81 | 90 | trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions |
| 82 | 91 | sprintf( |