php-stubs/wordpress-globals
Stub declarations for WordPress globals like $wpdb, $post, and $wp_query, giving PHPStan, Psalm, and other static analyzers accurate types. Pairs with php-stubs/wordpress-stubs to silence undefined-variable warnings and improve autocompletion in plugin and theme code.
$wpdb, $post, WP_DEBUG, and dozens of other globals/constants in every repo. The build alternative is generating your own stubs and owning their drift forever — low value for a non-differentiating concern.php-stubs/wordpress-stubs) rather than a standalone initiative. It is not a product capability; it's CI hygiene.php-stubs/wordpress-stubs; you want the global-variable/global-constant slice without committing generated stubs; and you're comfortable pinning a dev-only dependency that has no runtime footprint.ignoreErrors entries or a locally patched stub until upstream catches up.wordpress-stubs, or a bundled solution like szepeviktor/phpstan-wordpress that wires stubs into PHPStan for you); you require an actively maintained dependency policy (13 stars and a 2020 release is a maintenance-risk signal); you're not doing static analysis at all (then it adds nothing); or you need runtime behavior (this package does nothing at runtime).For executives: this is a zero-cost, dev-only helper that makes our WordPress code-quality checks actually usable. It doesn't ship to production, adds no runtime risk, and its only job is to stop our static analysis from flagging WordPress's own globals and constants as errors. Net effect: fewer false alarms in code review, faster PR turnaround, and a real chance of catching typos in constant names that would otherwise fail silently.
For engineering: add it as a require-dev dependency alongside wordpress-stubs, pin the version, and let PHPStan/Psalm resolve $wpdb, $post, WP_DEBUG, and friends. Two caveats to own: it's a 2020 snapshot, so a handful of newer core constants may need suppression until upstream updates, and it is analysis-only — no runtime behavior, no production impact. If maintaining it becomes friction, the fallback is a bundled PHPStan WordPress extension that wraps the same stubs, at the cost of one more opinionated dependency.
How can I help you explore Laravel packages today?