Skip to content

Commit 327e397

Browse files
committed
Fixed formatting issues. Temporarily removed QueryLifecycle class from QA as this is a POC and not actually ready.
1 parent 10178ad commit 327e397

File tree

7 files changed

+31
-25
lines changed

7 files changed

+31
-25
lines changed

plugins/wpgraphql-logging/deactivation.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?php
2-
3-
declare(strict_types=1);
4-
52
/**
63
* Deactivation Hook
74
*
@@ -10,6 +7,8 @@
107
* @since 0.0.1
118
*/
129

10+
declare(strict_types=1);
11+
1312
use WPGraphQL\Logging\Plugin;
1413

1514
/**

plugins/wpgraphql-logging/phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<exclude-pattern>*/phpunit.xml*</exclude-pattern>
1616
<exclude-pattern>**/tests/**</exclude-pattern>
1717
<exclude-pattern>*/vendor/*</exclude-pattern>
18+
<exclude-pattern>*/src/Events/QueryEventLifecycle.php</exclude-pattern>
1819

1920
<!-- ===================================== -->
2021
<!-- CLI Arguments & Version Config -->

plugins/wpgraphql-logging/phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ parameters:
3030
paths:
3131
- wpgraphql-logging.php
3232
- src/
33+
excludePaths:
34+
- src/Events/QueryEventLifecycle.php

plugins/wpgraphql-logging/psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
<file name="deactivation.php"/>
1616
<file name="vendor/autoload.php"/>
1717
<directory name="src"/>
18+
<ignoreFiles>
19+
<file name="src/Events/QueryEventLifecycle.php"/>
20+
</ignoreFiles>
1821
</projectFiles>
1922

23+
2024
<plugins>
2125
<pluginClass class="PsalmWordPress\Plugin"/>
2226
</plugins>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class LoggerService {
4444
/**
4545
* The instance of the logger based off the channel name.
4646
*
47-
* @var array<LoggerService>
47+
* @var array<\WPGraphQL\Logging\Logger\LoggerService>
4848
*/
4949
protected static array $instances = [];
5050

@@ -90,16 +90,16 @@ public static function get_instance(
9090
?array $processors = null,
9191
?array $default_context = null
9292
): LoggerService {
93-
if ( isset(self::$instances[$channel]) ) {
94-
return self::$instances[$channel];
93+
if ( isset( self::$instances[ $channel ] ) ) {
94+
return self::$instances[ $channel ];
9595
}
9696

9797
$processors = $processors ?? self::get_default_processors();
9898
$handlers = $handlers ?? self::get_default_handlers();
9999
$default_context = $default_context ?? self::get_default_context();
100100

101-
self::$instances[$channel] = new self( $channel, $handlers, $processors, $default_context );
102-
return self::$instances[$channel];
101+
self::$instances[ $channel ] = new self( $channel, $handlers, $processors, $default_context );
102+
return self::$instances[ $channel ];
103103
}
104104

105105
/**

plugins/wpgraphql-logging/src/Plugin.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ public function setup(): void {
5454
QueryEventLifecycle::init();
5555
}
5656

57+
/**
58+
* Activation callback for the plugin.
59+
*/
60+
public static function activate(): void {
61+
DatabaseEntity::create_table();
62+
}
63+
64+
/**
65+
* Deactivation callback for the plugin.
66+
*/
67+
public static function deactivate(): void {
68+
// @TODO: Add configuration to determine if the table should be dropped on deactivation.
69+
DatabaseEntity::drop_table();
70+
}
71+
5772
/**
5873
* Throw error on object clone.
5974
* The whole idea of the singleton design pattern is that there is a single object
@@ -77,19 +92,4 @@ public function __wakeup(): void {
7792
// De-serializing instances of the class is forbidden.
7893
_doing_it_wrong( __METHOD__, 'De-serializing instances of the plugin Main class is not allowed.', '0.0.1' );
7994
}
80-
81-
/**
82-
* Activation callback for the plugin.
83-
*/
84-
public static function activate(): void {
85-
DatabaseEntity::create_table();
86-
}
87-
88-
/**
89-
* Deactivation callback for the plugin.
90-
*/
91-
public static function deactivate(): void {
92-
// @TODO: Add configuration to determine if the table should be dropped on deactivation.
93-
DatabaseEntity::drop_table();
94-
}
9595
}

plugins/wpgraphql-logging/wpgraphql-logging.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,6 @@ function wpgraphql_logging_load_textdomain(): void {
140140
add_action( 'init', 'wpgraphql_logging_load_textdomain', 1, 0 );
141141

142142
/** @psalm-suppress HookNotFound */
143-
add_action( 'plugins_loaded', function() : void {
143+
add_action( 'plugins_loaded', static function (): void {
144144
wpgraphql_logging_init();
145-
}, 10, 0 );
145+
}, 10, 0 );

0 commit comments

Comments
 (0)