@@ -990,8 +990,8 @@ function _wp_relative_upload_path( $path ) {
990990 * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output
991991 * @phpstan-return (
992992 * $args is array{ fields: 'ids', ... } ? int[] : (
993- * $output is 'ARRAY_A' ? array<int, array<string, mixed>> : (
994- * $output is 'ARRAY_N' ? array<int, array<int, mixed>> : WP_Post[]
993+ * $output is 'ARRAY_A' ? array<int, non-empty- array<string, mixed>> : (
994+ * $output is 'ARRAY_N' ? array<int, non-empty- array<int, mixed>> : WP_Post[]
995995 * )
996996 * )
997997 * )
@@ -1040,13 +1040,17 @@ function get_children( $args = '', $output = OBJECT ) {
10401040 } elseif ( ARRAY_A === $ output ) {
10411041 $ weeuns = array ();
10421042 foreach ( (array ) $ kids as $ kid ) {
1043- $ weeuns [ $ kid ->ID ] = get_object_vars ( $ kids [ $ kid ->ID ] );
1043+ /** @var non-empty-array<string, mixed> $vars */
1044+ $ vars = get_object_vars ( $ kids [ $ kid ->ID ] );
1045+ $ weeuns [ $ kid ->ID ] = $ vars ;
10441046 }
10451047 return $ weeuns ;
10461048 } elseif ( ARRAY_N === $ output ) {
10471049 $ babes = array ();
10481050 foreach ( (array ) $ kids as $ kid ) {
1049- $ babes [ $ kid ->ID ] = array_values ( get_object_vars ( $ kids [ $ kid ->ID ] ) );
1051+ /** @var non-empty-array<string, mixed> $vars */
1052+ $ vars = get_object_vars ( $ kids [ $ kid ->ID ] );
1053+ $ babes [ $ kid ->ID ] = array_values ( $ vars );
10501054 }
10511055 return $ babes ;
10521056 } else {
@@ -1124,8 +1128,8 @@ function get_extended( $post ) {
11241128 * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output
11251129 * @phpstan-param 'raw'|'edit'|'db'|'display' $filter
11261130 * @phpstan-return (
1127- * $output is 'ARRAY_A' ? array<string, mixed>|null : (
1128- * $output is 'ARRAY_N' ? array<int, mixed>|null : (
1131+ * $output is 'ARRAY_A' ? non-empty- array<string, mixed>|null : (
1132+ * $output is 'ARRAY_N' ? non-empty- array<int, mixed>|null : (
11291133 * WP_Post|null
11301134 * )
11311135 * )
@@ -4452,7 +4456,7 @@ function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array(
44524456 *
44534457 * @phpstan-param 'OBJECT'|'ARRAY_A' $output
44544458 * @phpstan-return (
4455- * $output is 'ARRAY_A' ? array<int, array<string, mixed>> : WP_Post[]|false
4459+ * $output is 'ARRAY_A' ? array<int, non-empty- array<string, mixed>> : WP_Post[]|false
44564460 * )
44574461 */
44584462function wp_get_recent_posts ( $ args = array (), $ output = ARRAY_A ) {
@@ -4485,12 +4489,13 @@ function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
44854489
44864490 // Backward compatibility. Prior to 3.1 expected posts to be returned in array.
44874491 if ( ARRAY_A === $ output ) {
4492+ $ posts = array ();
44884493 foreach ( $ results as $ key => $ result ) {
4489- /** @var array<string, mixed> $object_vars */
4490- $ object_vars = get_object_vars ( $ result );
4491- $ results [ $ key ] = $ object_vars ;
4494+ /** @var non-empty- array<string, mixed> $object_vars */
4495+ $ object_vars = get_object_vars ( $ result );
4496+ $ posts [ $ key ] = $ object_vars ;
44924497 }
4493- return $ results ? $ results : array () ;
4498+ return $ posts ;
44944499 }
44954500
44964501 return $ results ? $ results : false ;
@@ -6146,6 +6151,10 @@ function trackback_url_list( $tb_list, $post_id ) {
61466151 // Get post data.
61476152 $ postdata = get_post ( $ post_id , ARRAY_A );
61486153
6154+ if ( ! $ postdata ) {
6155+ return ;
6156+ }
6157+
61496158 // Form an excerpt.
61506159 $ excerpt = strip_tags ( $ postdata ['post_excerpt ' ] ? $ postdata ['post_excerpt ' ] : $ postdata ['post_content ' ] );
61516160
@@ -6206,8 +6215,8 @@ function get_all_page_ids() {
62066215 * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output
62076216 * @phpstan-param 'raw'|'edit'|'db'|'display' $filter
62086217 * @phpstan-return (
6209- * $output is 'ARRAY_A' ? array<string, mixed>|null : (
6210- * $output is 'ARRAY_N' ? array<int, mixed>|null : (
6218+ * $output is 'ARRAY_A' ? non-empty- array<string, mixed>|null : (
6219+ * $output is 'ARRAY_N' ? non-empty- array<int, mixed>|null : (
62116220 * WP_Post|null
62126221 * )
62136222 * )
@@ -6234,8 +6243,8 @@ function get_page( $page, $output = OBJECT, $filter = 'raw' ) {
62346243 * @phpstan-param 'OBJECT'|'ARRAY_A'|'ARRAY_N' $output
62356244 * @phpstan-param string|string[] $post_type
62366245 * @phpstan-return (
6237- * $output is 'ARRAY_A' ? array<string, mixed>|null : (
6238- * $output is 'ARRAY_N' ? array<int, mixed>|null : (
6246+ * $output is 'ARRAY_A' ? non-empty- array<string, mixed>|null : (
6247+ * $output is 'ARRAY_N' ? non-empty- array<int, mixed>|null : (
62396248 * WP_Post|null
62406249 * )
62416250 * )
0 commit comments