[wp-trac] [WordPress Trac] #64703: Code Modernization: Replace void in PHPDoc union return types with null in class-wpdb.php

WordPress Trac noreply at wordpress.org
Mon Feb 23 23:36:16 UTC 2026


#64703: Code Modernization: Replace void in PHPDoc union return types with null in
class-wpdb.php
--------------------------+------------------------------
 Reporter:  apermo        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  4.3
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, thanks for the ticket!

 Replying to [ticket:64703 apermo]:
 > ||= Function =||= Line =||= Current =||= Recommendation =||= Since =||
 > || `check_connection()` || 2120 || `bool|void` || `bool` (void incorrect
 — always returns bool or terminates) || 4.3 ||

 Not sure if that's correct, as `wpdb::check_connection()` can still return
 nothing if it proceeds to the `dead_db()` call. As it stands, the proposed
 change causes a PHPStan warning (as seen on GitHub):
 > `Method wpdb::check_connection() should return bool but return statement
 is missing.`

 Perhaps an explicit `return false` should be added at the end?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64703#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list