Skip to content

Commit e3e7ec0

Browse files
committed
Fixed Psalm errors for the logging plugin.
1 parent eb60091 commit e3e7ec0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

plugins/wpgraphql-logging/src/Events/QueryEventLifecycle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected function setup(): void {
125125

126126
// Add filter hooks.
127127
foreach ( $filter_events as $event_name => $data ) {
128-
add_filter( $event_name, [ $this->filter_logger, $data['method'] ], 10, $data['accepted_args'] );
128+
add_filter( $event_name, [ $this->filter_logger, $data['method'] ], 10, min( $data['accepted_args'], 3 ) );
129129
}
130130
}
131131
}

plugins/wpgraphql-logging/src/Logger/LoggingHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ protected function is_logging_enabled( array $config ): bool {
3636
$ip_restrictions = $config[ Basic_Configuration_Tab::IP_RESTRICTIONS ] ?? '';
3737
if ( $is_enabled && ! empty( $ip_restrictions ) ) {
3838
$allowed_ips = array_map( 'trim', explode( ',', $ip_restrictions ) );
39-
if ( ! in_array( $_SERVER['REMOTE_ADDR'], $allowed_ips, true ) ) { // @phpcs:ignore
39+
$remote_addr = $_SERVER['REMOTE_ADDR'] ?? ''; // @phpcs:ignore
40+
if ( ! in_array( $remote_addr, $allowed_ips, true ) ) {
4041
$is_enabled = false;
4142
}
4243
}

0 commit comments

Comments
 (0)