| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | * @since 2.0.0 Added the "modules" option. |
| 29 | 29 | * @var array<string, mixed> |
| 30 | 30 | */ |
| 31 | - protected $default_plugin_options = array( | |
| 31 | + protected array $default_plugin_options = array( | |
| 32 | 32 | 'plugin_options_db_version' => 0, |
| 33 | 33 | 'table_scheme_db_version' => 0, |
| 34 | 34 | 'prev_tablepress_version' => '0', |
| 35 | 35 | 'tablepress_version' => TablePress::version, |
| @@ -47,11 +47,11 @@ | ||
| 47 | 47 | /** |
| 48 | 48 | * Default User Options. |
| 49 | 49 | * |
| 50 | 50 | * @since 1.0.0 |
| 51 | - * @var array<string, mixed>> | |
| 51 | + * @var array<string, mixed> | |
| 52 | 52 | */ |
| 53 | - protected $default_user_options = array( | |
| 53 | + protected array $default_user_options = array( | |
| 54 | 54 | 'user_options_db_version' => TablePress::db_version, // To prevent saving on first load. |
| 55 | 55 | 'admin_menu_parent_page' => 'middle', |
| 56 | 56 | 'message_first_visit' => true, |
| 57 | 57 | 'message_superseded_extensions' => true, |
| @@ -62,19 +62,17 @@ | ||
| 62 | 62 | /** |
| 63 | 63 | * Instance of WP_Option class for Plugin Options. |
| 64 | 64 | * |
| 65 | 65 | * @since 1.0.0 |
| 66 | - * @var TablePress_WP_Option | |
| 67 | 66 | */ |
| 68 | - protected $plugin_options; | |
| 67 | + protected \TablePress_WP_Option $plugin_options; | |
| 69 | 68 | |
| 70 | 69 | /** |
| 71 | 70 | * Instance of WP_User_Option class for User Options. |
| 72 | 71 | * |
| 73 | 72 | * @since 1.0.0 |
| 74 | - * @var TablePress_WP_User_Option | |
| 75 | 73 | */ |
| 76 | - protected $user_options; | |
| 74 | + protected \TablePress_WP_User_Option $user_options; | |
| 77 | 75 | |
| 78 | 76 | /** |
| 79 | 77 | * Init Options Model by creating the object instances for the Plugin and User Options. |
| 80 | 78 | * |
| @@ -326,9 +324,9 @@ | ||
| 326 | 324 | public function map_tablepress_meta_caps( array $caps, /* string */ $cap, int $user_id, array $args ): array { |
| 327 | 325 | // Don't use a type hint for the `$cap` argument as many WordPress plugins seem to be passing `null` to capability check or admin menu functions. |
| 328 | 326 | |
| 329 | 327 | // Protect against other plugins not supplying a string for the `$cap` argument. |
| 330 | - if ( ! is_string( $cap ) ) { | |
| 328 | + if ( ! is_string( $cap ) ) { // @phpstan-ignore function.alreadyNarrowedType (The `is_string()` check is needed as the input is coming from a filter hook.) | |
| 331 | 329 | return $caps; |
| 332 | 330 | } |
| 333 | 331 | |
| 334 | 332 | if ( ! in_array( $cap, array( 'tablepress_edit_table', 'tablepress_edit_table_id', 'tablepress_copy_table', 'tablepress_delete_table', 'tablepress_export_table', 'tablepress_preview_table' ), true ) ) { |