Skip to content

Commit 9258593

Browse files
committed
style: annotate $wpdb globals with @var to satisfy phpstan
1 parent ef14f36 commit 9258593

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

inc/Storage/WorktreeInventoryRepository.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class WorktreeInventoryRepository {
2626
*/
2727
public static function install_schema(): void {
2828
global $wpdb;
29+
/** @var \wpdb $wpdb */
2930

3031
if ( ! isset($wpdb) ) {
3132
return;
@@ -90,6 +91,7 @@ public static function install_schema(): void {
9091
*/
9192
public static function table_name(): string {
9293
global $wpdb;
94+
/** @var \wpdb $wpdb */
9395
$prefix = isset($wpdb->prefix) ? (string) $wpdb->prefix : '';
9496
return $prefix . self::TABLE;
9597
}
@@ -102,6 +104,7 @@ public static function table_name(): string {
102104
*/
103105
public function upsert( array $row ): bool {
104106
global $wpdb;
107+
/** @var \wpdb $wpdb */
105108

106109
if ( ! isset($wpdb) ) {
107110
return false;
@@ -125,6 +128,7 @@ public function upsert( array $row ): bool {
125128
*/
126129
public function delete( string $handle ): bool {
127130
global $wpdb;
131+
/** @var \wpdb $wpdb */
128132

129133
$handle = trim($handle);
130134
if ( '' === $handle || ! isset($wpdb) || ! method_exists($wpdb, 'delete') ) {
@@ -142,6 +146,7 @@ public function delete( string $handle ): bool {
142146
*/
143147
public function get( string $handle ): ?array {
144148
global $wpdb;
149+
/** @var \wpdb $wpdb */
145150

146151
$handle = trim($handle);
147152
if ( '' === $handle || ! isset($wpdb) ) {
@@ -171,6 +176,7 @@ public function get( string $handle ): ?array {
171176
*/
172177
public function mark_missing( string $handle ): bool {
173178
global $wpdb;
179+
/** @var \wpdb $wpdb */
174180

175181
$handle = trim($handle);
176182
if ( '' === $handle || ! isset($wpdb) || ! method_exists($wpdb, 'update') ) {
@@ -296,6 +302,7 @@ public function pruneMissing( array $opts = array() ): array {
296302
*/
297303
private function missing_path_rows(): array {
298304
global $wpdb;
305+
/** @var \wpdb $wpdb */
299306

300307
if ( ! isset($wpdb) || ! method_exists($wpdb, 'get_results') ) {
301308
return array();
@@ -318,6 +325,7 @@ private function missing_path_rows(): array {
318325
*/
319326
public function list( ?string $repo = null ): array {
320327
global $wpdb;
328+
/** @var \wpdb $wpdb */
321329

322330
if ( ! isset($wpdb) || ! method_exists($wpdb, 'get_results') ) {
323331
return array();

0 commit comments

Comments
 (0)