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
2 changes: 2 additions & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
'addslashes_gpc' => ['T', '@phpstan-template' => 'T', 'gpc' => 'T'],
'block_version' => ["(\$content is '' ? 0 : 0|1)"],
'bool_from_yn' => ["(\$yn is 'y' ? true : false)"],
'build_dropdown_script_block_core_categories' => ['non-falsy-string'],
'check_admin_referer' => ['1|2|false', 'action' => '-1|string'],
'check_ajax_referer' => ['1|2|false', 'action' => '-1|string'],
'comment_class' => ['($display is true ? void : string)'],
Expand Down Expand Up @@ -120,6 +121,7 @@
'prep_atom_text_construct' => ["array{'html'|'text'|'xhtml', string}"],
'previous_posts' => ['($display is true ? void : string)'],
'rawurlencode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
'render_block_core_categories' => ['non-falsy-string'],
'rest_authorization_required_code' => ['401|403'],
'rest_sanitize_boolean' => ["(T is bool ? T : (T is ''|'false'|'FALSE'|'0'|0 ? false : true))", '@phpstan-template T' => 'of bool|string|int', 'value' => 'T'],
'rest_ensure_response' => ['($response is \WP_Error ? \WP_Error : \WP_REST_Response)'],
Expand Down
1 change: 1 addition & 0 deletions tests/TypeInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/__return.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/_get_list_table.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/absint.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/block_core.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/block_version.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bookmark-admin.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bookmark.php');
Expand Down
13 changes: 13 additions & 0 deletions tests/data/block_core.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 build_dropdown_script_block_core_categories;
use function render_block_core_categories;
use function PHPStan\Testing\assertType;

assertType('non-falsy-string', render_block_core_categories(Faker::array(), Faker::string(), Faker::wpBlock()));

assertType('non-falsy-string', build_dropdown_script_block_core_categories(Faker::string()));
2 changes: 2 additions & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -96571,6 +96571,7 @@ function block_core_calendar_update_has_published_post_on_transition_post_status
* @param WP_Block $block Block instance.
*
* @return string Returns the categories list/dropdown markup.
* @phpstan-return non-falsy-string
*/
function render_block_core_categories($attributes, $content, $block)
{
Expand All @@ -96583,6 +96584,7 @@ function render_block_core_categories($attributes, $content, $block)
* @param string $dropdown_id ID of the dropdown field.
*
* @return string Returns the dropdown onChange redirection script.
* @phpstan-return non-falsy-string
*/
function build_dropdown_script_block_core_categories($dropdown_id)
{
Expand Down