| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Frontend Template Tag functions, only available when the Frontend Controller is loaded | |
| 3 | + * Frontend Template Tag functions, only available when the Frontend Controller is loaded. | |
| 4 | 4 | * |
| 5 | 5 | * @package TablePress |
| 6 | 6 | * @subpackage Frontend Template Tag functions |
| 7 | 7 | * @author Tobias Bäthge |
| @@ -7,72 +7,65 @@ | ||
| 7 | 7 | * @author Tobias Bäthge |
| 8 | 8 | * @since 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | +declare(strict_types=1); | |
| 12 | + | |
| 11 | 13 | /** |
| 12 | - * Add template tag function for "table" Shortcode to be used anywhere in the template, returns the table HTML. | |
| 14 | + * Provides template tag functionality for the "table" Shortcode, to be used anywhere in the template, returns the table HTML. | |
| 13 | 15 | * |
| 14 | - * This function provides a possibility to show a table anywhere in a WordPress template, | |
| 15 | - * which is needed for any region of a theme that can not use Shortcodes. | |
| 16 | - * | |
| 17 | 16 | * @since 1.0.0 |
| 18 | 17 | * |
| 19 | - * @param string|array $table_query Query string like list or array of parameters for Shortcode "table" rendering. | |
| 18 | + * @param string|array<string, mixed> $table_query Query-string-like list or array of parameters for Shortcode "table" rendering. | |
| 20 | 19 | * @return string HTML of the rendered table. |
| 21 | 20 | */ |
| 22 | -function tablepress_get_table( $table_query ) { | |
| 21 | +function tablepress_get_table( /* string|array */ $table_query ): string { | |
| 23 | 22 | if ( is_array( $table_query ) ) { |
| 24 | 23 | $atts = $table_query; |
| 25 | 24 | } else { |
| 26 | 25 | parse_str( (string) $table_query, $atts ); |
| 27 | 26 | } |
| 28 | - return TablePress::$controller->shortcode_table( $atts ); | |
| 27 | + return TablePress::$controller->shortcode_table( $atts ); // @phpstan-ignore argument.type | |
| 29 | 28 | } |
| 30 | 29 | |
| 31 | 30 | /** |
| 32 | - * Add template tag function for "table" Shortcode to be used anywhere in the template, echoes the table HTML. | |
| 31 | + * Provides template tag functionality for the "table" Shortcode, to be used anywhere in the template, echoes the table HTML. | |
| 33 | 32 | * |
| 34 | - * This function provides a possibility to show a table anywhere in a WordPress template, | |
| 35 | - * which is needed for any region of a theme that can not use Shortcodes. | |
| 36 | - * | |
| 37 | 33 | * @since 1.0.0 |
| 38 | 34 | * |
| 39 | 35 | * @see tablepress_get_table() |
| 40 | 36 | * |
| 41 | - * @param string|array $table_query Query string like list or array of parameters for Shortcode "table" rendering. | |
| 37 | + * @param string|array<string, mixed> $table_query Query-string-like list or array of parameters for Shortcode "table" rendering. | |
| 42 | 38 | */ |
| 43 | -function tablepress_print_table( $table_query ) { | |
| 39 | +function tablepress_print_table( /* string|array */ $table_query ): void { | |
| 44 | 40 | echo tablepress_get_table( $table_query ); |
| 45 | 41 | } |
| 46 | 42 | |
| 47 | 43 | /** |
| 48 | - * Add template tag function for "table-info" Shortcode to be used anywhere in the template, returns the info. | |
| 44 | + * Provides template tag functionality for the "table-info" Shortcode, to be used anywhere in the template, returns the info. | |
| 49 | 45 | * |
| 50 | 46 | * @since 1.0.0 |
| 51 | 47 | * |
| 52 | - * @param string|array $table_query Query string like list or array of parameters for Shortcode "table-info" rendering. | |
| 48 | + * @param string|array<string, mixed> $table_query Query-string-like list or array of parameters for Shortcode "table-info" rendering. | |
| 53 | 49 | * @return string Desired table information. |
| 54 | 50 | */ |
| 55 | -function tablepress_get_table_info( $table_query ) { | |
| 51 | +function tablepress_get_table_info( /* string|array */ $table_query ): string { | |
| 56 | 52 | if ( is_array( $table_query ) ) { |
| 57 | 53 | $atts = $table_query; |
| 58 | 54 | } else { |
| 59 | 55 | parse_str( (string) $table_query, $atts ); |
| 60 | 56 | } |
| 61 | - return TablePress::$controller->shortcode_table_info( $atts ); | |
| 57 | + return TablePress::$controller->shortcode_table_info( $atts ); // @phpstan-ignore argument.type | |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | 60 | /** |
| 65 | - * Add template tag function for "table-info" Shortcode to be used anywhere in the template, echoes the info. | |
| 61 | + * Provides template tag functionality for the "table-info" Shortcode, to be used anywhere in the template, echoes the info. | |
| 66 | 62 | * |
| 67 | - * This function provides a possibility to show table info data anywhere in a WordPress template, | |
| 68 | - * which is needed for any region of a theme that can not use Shortcodes. | |
| 69 | - * | |
| 70 | 63 | * @since 1.0.0 |
| 71 | 64 | * |
| 72 | 65 | * @see tablepress_get_table_info() |
| 73 | 66 | * |
| 74 | - * @param string|array $table_query Query string like list or array of parameters for Shortcode "table-info" rendering. | |
| 67 | + * @param string|array<string, mixed> $table_query Query-string-like list or array of parameters for Shortcode "table-info" rendering. | |
| 75 | 68 | */ |
| 76 | -function tablepress_print_table_info( $table_query ) { | |
| 69 | +function tablepress_print_table_info( /* string|array */ $table_query ): void { | |
| 77 | 70 | echo tablepress_get_table_info( $table_query ); |
| 78 | 71 | } |