Commit 1a79b25db1 for wordpress.org

commit 1a79b25db10b34f2c2d78c8dfcd181058dc18537
Author: westonruter <westonruter@git.wordpress.org>
Date:   Tue Oct 27 05:15:52 2026 +0000

    Docs: Add PHPStan type assertions.

    Functions that validate their argument now tell PHPStan what a `true` result implies about it, so callers no longer need redundant checks after, for example, `taxonomy_exists()` or `wp_is_uuid()`. Each assertion uses the equality form (`=Type`), which narrows only when the function returns `true`. The plain form also asserts the negation on a `false` return, which is wrong for these functions: an unregistered taxonomy or a relative path is still a non-falsy string. For that reason the existing assertion on `path_is_absolute()` is switched to the equality form as well, since an argument already known to be a non-falsy string was otherwise narrowed to `never` when the path was relative, making that branch look unreachable.

    The annotations are adopted from the function map of the php-stubs/wordpress-stubs package.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13896.
    Follow-up to r63941, r64235.

    Props swissspidy, marian1, szepeviktor, westonruter.
    See #65817.

    Built from https://develop.svn.wordpress.org/trunk@64795


    git-svn-id: http://core.svn.wordpress.org/trunk@63945 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 3b9e247fd4..f4e319c20c 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -2149,8 +2149,8 @@ function wp_mkdir_p( $target ) {
  * @param string $path File path.
  * @return bool True if path is absolute, false is not absolute.
  *
+ * @phpstan-assert-if-true =non-falsy-string $path
  * @phpstan-return ( $path is non-falsy-string ? bool : false )
- * @phpstan-assert-if-true non-falsy-string $path
  */
 function path_is_absolute( $path ) {
 	/*
@@ -7597,6 +7597,8 @@ function _device_can_upload() {
  *
  * @param string $path The resource path or URL.
  * @return bool True if the path is a stream URL.
+ *
+ * @phpstan-assert-if-true =non-falsy-string $path
  */
 function wp_is_stream( $path ) {
 	$scheme_separator = strpos( $path, '://' );
@@ -8229,6 +8231,7 @@ function wp_generate_uuid4() {
  *                       to accept any UUID version. Otherwise, only version allowed is `4`.
  * @return bool The string is a valid UUID or false on failure.
  *
+ * @phpstan-assert-if-true =lowercase-string&non-falsy-string $uuid
  * @phpstan-return ( $version is 4|null ? bool : false )
  */
 function wp_is_uuid( $uuid, $version = null ) {
diff --git a/wp-includes/shortcodes.php b/wp-includes/shortcodes.php
index bd5f74a1ec..d6bb8db1e6 100644
--- a/wp-includes/shortcodes.php
+++ b/wp-includes/shortcodes.php
@@ -131,6 +131,8 @@ function remove_all_shortcodes() {
  *
  * @param string $tag Shortcode tag to check.
  * @return bool Whether the given shortcode exists.
+ *
+ * @phpstan-assert-if-true =non-empty-string $tag
  */
 function shortcode_exists( $tag ) {
 	global $shortcode_tags;
@@ -148,6 +150,8 @@ function shortcode_exists( $tag ) {
  * @param string $tag     Shortcode tag to check.
  * @return bool Whether the passed content contains the given shortcode.
  *
+ * @phpstan-assert-if-true =non-falsy-string $content
+ * @phpstan-assert-if-true =non-empty-string $tag
  * @phpstan-return ( $tag is '' ? false : ( $content is empty ? false : bool ) )
  */
 function has_shortcode( $content, $tag ) {
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index ea13e99271..e0f3c4ed8f 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -375,6 +375,7 @@ function get_taxonomy( $taxonomy ) {
  * @param string $taxonomy Name of taxonomy object.
  * @return bool Whether the taxonomy exists.
  *
+ * @phpstan-assert-if-true =non-falsy-string $taxonomy
  * @phpstan-return ( $taxonomy is non-falsy-string ? bool : false )
  */
 function taxonomy_exists( $taxonomy ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index da001de5ee..7a8ec8cd4b 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-beta1-64794';
+$wp_version = '7.2-beta1-64795';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.