Skip to content

Commit 34ce41f

Browse files
committed
Updated packages. Fixed some QA issues.
1 parent b478333 commit 34ce41f

File tree

8 files changed

+240
-230
lines changed

8 files changed

+240
-230
lines changed

plugins/wpgraphql-logging/composer.lock

Lines changed: 149 additions & 137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/CheckboxField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class CheckboxField extends AbstractSettingsField {
1717
/**
1818
* Render the checkbox field.
1919
*
20-
* @param array<string> $option_value The option value.
21-
* @param string $setting_key The setting key.
22-
* @param string $tab_key The tab key.
20+
* @param array<string, mixed> $option_value The option value.
21+
* @param string $setting_key The setting key.
22+
* @param string $tab_key The tab key.
2323
*
2424
* @return string The rendered field HTML.
2525
*/

plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/SelectField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public function __construct(
4141
/**
4242
* Render the select field.
4343
*
44-
* @param array<string> $option_value The option value.
45-
* @param string $setting_key The setting key.
46-
* @param string $tab_key The tab key.
44+
* @param array<string, mixed> $option_value The option value.
45+
* @param string $setting_key The setting key.
46+
* @param string $tab_key The tab key.
4747
*
4848
* @return string The rendered field HTML.
4949
*/

plugins/wpgraphql-logging/src/Admin/Settings/Fields/Field/TextInputField.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public function __construct(
4141
/**
4242
* Render the text input field.
4343
*
44-
* @param array<string> $option_value The option value.
45-
* @param string $setting_key The setting key.
46-
* @param string $tab_key The tab key.
44+
* @param array<string, mixed> $option_value The option value.
45+
* @param string $setting_key The setting key.
46+
* @param string $tab_key The tab key.
4747
*
4848
* @return string The rendered field HTML.
4949
*/

plugins/wpgraphql-logging/src/Admin/Settings/Fields/SettingsFieldInterface.php

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,61 @@
1111
* Implementing classes must handle rendering, sanitization, and integration with WordPress Settings API.
1212
*
1313
* @package WPGraphQL\Logging
14+
*
1415
* @since 0.0.1
1516
*/
1617
interface SettingsFieldInterface {
18+
/**
19+
* Render the settings field.
20+
*
21+
* This should return the HTML for the field. Always escape output using esc_html(), esc_attr(), or wp_kses_post() as appropriate.
22+
*
23+
* @param array<string, mixed> $option_value The option value(s) for this field.
24+
* @param string $setting_key The setting key associated with this field.
25+
* @param string $tab_key The tab key that this field belongs to.
26+
*
27+
* @return string Rendered HTML for the field.
28+
*/
29+
public function render_field(array $option_value, string $setting_key, string $tab_key): string;
1730

18-
/**
19-
* Render the settings field.
20-
*
21-
* This should return the HTML for the field. Always escape output using esc_html(), esc_attr(), or wp_kses_post() as appropriate.
22-
*
23-
* @param array<string, mixed> $option_value The option value(s) for this field.
24-
* @param string $setting_key The setting key associated with this field.
25-
* @param string $tab_key The tab key that this field belongs to.
26-
*
27-
* @return string Rendered HTML for the field.
28-
*/
29-
public function render_field(array $option_value, string $setting_key, string $tab_key): string;
30-
31-
/**
32-
* Get the unique field ID.
33-
*
34-
* Must be unique within the tab/page to avoid conflicts.
35-
*
36-
* @return string The field ID.
37-
*/
38-
public function get_id(): string;
31+
/**
32+
* Get the unique field ID.
33+
*
34+
* Must be unique within the tab/page to avoid conflicts.
35+
*
36+
* @return string The field ID.
37+
*/
38+
public function get_id(): string;
3939

40-
/**
41-
* Determine if the field should render for a specific tab.
42-
*
43-
* @param string $tab_key The tab key to check.
44-
*
45-
* @return bool True if the field should render for this tab.
46-
*/
47-
public function should_render_for_tab(string $tab_key): bool;
40+
/**
41+
* Determine if the field should render for a specific tab.
42+
*
43+
* @param string $tab_key The tab key to check.
44+
*
45+
* @return bool True if the field should render for this tab.
46+
*/
47+
public function should_render_for_tab(string $tab_key): bool;
4848

49-
/**
50-
* Add the field to WordPress Settings API.
51-
*
52-
* Implementing classes should call add_settings_field() internally with proper sanitization callback.
53-
*
54-
* @param string $section The settings section ID.
55-
* @param string $page The settings page ID.
56-
* @param array<string, mixed> $args Additional field arguments.
57-
*/
58-
public function add_settings_field(string $section, string $page, array $args): void;
49+
/**
50+
* Add the field to WordPress Settings API.
51+
*
52+
* Implementing classes should call add_settings_field() internally with proper sanitization callback.
53+
*
54+
* @param string $section The settings section ID.
55+
* @param string $page The settings page ID.
56+
* @param array<string, mixed> $args Additional field arguments.
57+
*/
58+
public function add_settings_field(string $section, string $page, array $args): void;
5959

60-
/**
61-
* Sanitize the field value.
62-
*
63-
* Must ensure that all output saved to the database is safe.
64-
* For text: use sanitize_text_field(), for HTML: wp_kses_post(), etc.
65-
*
66-
* @param mixed $value The raw value from user input.
67-
*
68-
* @return mixed The sanitized value to store in the database.
69-
*/
70-
public function sanitize_field(mixed $value): mixed;
60+
/**
61+
* Sanitize the field value.
62+
*
63+
* Must ensure that all output saved to the database is safe.
64+
* For text: use sanitize_text_field(), for HTML: wp_kses_post(), etc.
65+
*
66+
* @param mixed $value The raw value from user input.
67+
*
68+
* @return mixed The sanitized value to store in the database.
69+
*/
70+
public function sanitize_field(mixed $value): mixed;
7171
}

plugins/wpgraphql-logging/src/Admin/Settings/Fields/Tab/SettingsTabInterface.php

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,45 @@
44

55
namespace WPGraphQL\Logging\Admin\Settings\Fields\Tab;
66

7-
use WPGraphQL\Logging\Admin\Settings\Fields\SettingsFieldInterface;
8-
97
/**
108
* Interface for settings tabs.
119
*
1210
* Defines the contract for a settings tab that groups related fields.
1311
* Each tab must provide its metadata and fields for registration in the WordPress Settings API.
1412
*
1513
* @package WPGraphQL\Logging
14+
*
1615
* @since 0.0.1
1716
*/
1817
interface SettingsTabInterface {
18+
/**
19+
* Get the settings fields for this tab.
20+
*
21+
* The returned array should be keyed by field ID and contain instances
22+
* implementing SettingsFieldInterface. These fields will be rendered
23+
* and registered automatically in the admin settings page.
24+
*
25+
* @return array<string, \WPGraphQL\Logging\Admin\Settings\Fields\SettingsFieldInterface> Fields keyed by their unique ID.
26+
*/
27+
public function get_fields(): array;
1928

20-
/**
21-
* Get the settings fields for this tab.
22-
*
23-
* The returned array should be keyed by field ID and contain instances
24-
* implementing SettingsFieldInterface. These fields will be rendered
25-
* and registered automatically in the admin settings page.
26-
*
27-
* @return array<string, SettingsFieldInterface> Fields keyed by their unique ID.
28-
*/
29-
public function get_fields(): array;
30-
31-
/**
32-
* Get the unique name/slug for this tab.
33-
*
34-
* Must be unique within the plugin to avoid conflicts between tabs.
35-
* This name is used in URLs, queries, and as the array key for field storage.
36-
*
37-
* @return string The tab name/slug.
38-
*/
39-
public static function get_name(): string;
29+
/**
30+
* Get the unique name/slug for this tab.
31+
*
32+
* Must be unique within the plugin to avoid conflicts between tabs.
33+
* This name is used in URLs, queries, and as the array key for field storage.
34+
*
35+
* @return string The tab name/slug.
36+
*/
37+
public static function get_name(): string;
4038

41-
/**
42-
* Get the human-readable label for this tab.
43-
*
44-
* The label is displayed in the admin UI as the tab title.
45-
* Should be internationalized using esc_html__().
46-
*
47-
* @return string The tab label.
48-
*/
49-
public static function get_label(): string;
39+
/**
40+
* Get the human-readable label for this tab.
41+
*
42+
* The label is displayed in the admin UI as the tab title.
43+
* Should be internationalized using esc_html__().
44+
*
45+
* @return string The tab label.
46+
*/
47+
public static function get_label(): string;
5048
}

plugins/wpgraphql-logging/src/Admin/View/List/ListTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Include the WP_List_Table class if not already loaded.
1212
if ( ! class_exists( 'WP_List_Table' ) ) {
13-
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; // @phpstan-ignore-line
13+
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
1414
}
1515

1616
/**

plugins/wpgraphql-logging/src/Logger/Database/DatabaseEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public static function get_schema(): string {
363363
* Creates the logging table in the database.
364364
*/
365365
public static function create_table(): void {
366-
require_once ABSPATH . 'wp-admin/includes/upgrade.php'; // @phpstan-ignore-line
366+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
367367
dbDelta( self::get_schema() );
368368
}
369369

@@ -373,7 +373,7 @@ public static function create_table(): void {
373373
public static function drop_table(): void {
374374
global $wpdb;
375375
$table_name = self::get_table_name();
376-
$wpdb->query( "DROP TABLE IF EXISTS {$table_name}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching
376+
$wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i', $table_name ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
377377
}
378378

379379
/**

0 commit comments

Comments
 (0)