Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
'wp_get_post_terms' => ["(\$post_id is 0 ? array{} : (\$taxonomy is empty ? array{} : ((\$args is array{fields: 'names'|'slugs'}&array ? list<string> : (\$args is array{fields: 'id=>name'|'id=>slug'}&array ? array<int, string> : (\$args is array{fields: 'id=>parent'}&array ? array<int, int> : (\$args is array{fields: 'ids'|'tt_ids'}&array ? list<int> : (\$args is array{fields: 'count'}&array ? numeric-string : array<int, \WP_Term>)))))|\WP_Error)))"],
'wp_get_schedule' => [null, 'args' => $cronArgsType],
'wp_get_scheduled_event' => [null, 'args' => $cronArgsType],
'wp_get_server_protocol' => ["'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'"],
'wp_insert_attachment' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_insert_category' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
'wp_insert_link' => ['($wp_error is false ? int<0, max> : int<1, max>|\WP_Error)'],
Expand Down
1 change: 1 addition & 0 deletions tests/TypeInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_get_post_tags.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_get_post_terms.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_get_object_terms.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_get_server_protocol.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_is_numeric_array.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_list_bookmarks.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/wp_list_categories.php');
Expand Down
13 changes: 13 additions & 0 deletions tests/data/wp_get_server_protocol.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace PhpStubs\WordPress\Core\Tests;

use function wp_get_server_protocol;
use function PHPStan\Testing\assertType;

assertType("'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'", wp_get_server_protocol());
assertType('false', wp_get_server_protocol() === 'HTTP/1');
assertType('bool', wp_get_server_protocol() === 'HTTP/3');
assertType('bool', wp_get_server_protocol() === Faker::string());
1 change: 1 addition & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -121207,6 +121207,7 @@ function wp_is_internal_link($link)
* @since 4.4.0
*
* @return string The HTTP protocol. Default: HTTP/1.0.
* @phpstan-return 'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'
*/
function wp_get_server_protocol()
{
Expand Down