Skip to content

Commit

Permalink
Add param types for Custom_Image_Header (#223)
Browse files Browse the repository at this point in the history
* Add param type for Custom_Image_Header::show_header_selector()

* Add param type for Custom_Image_Header::set_header_image()
  • Loading branch information
IanDelMar authored Sep 17, 2024
1 parent 1f15110 commit 9fc7c58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,6 @@
'WP_Widget_Factory::$widgets' => [null, '@phpstan-var' => 'array<string, \WP_Widget>'],
'WP_Widget_Factory::register' => [null, 'widget' => 'class-string<\WP_Widget>|\WP_Widget'],
'WP_Widget_Factory::unregister' => [null, 'widget' => 'class-string<\WP_Widget>|\WP_Widget'],
'Custom_Image_Header::show_header_selector' => [null, 'type' => "'default'|'uploaded'"],
'Custom_Image_Header::set_header_image' => [null, 'choice' => 'string|array{attachment_id: positive-int, url: string, width: non-negative-int, height: non-negative-int}'],
];
2 changes: 2 additions & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ public function process_default_headers()
*
* @param string $type The header type. One of 'default' (for the Uploaded Images control)
* or 'uploaded' (for the Uploaded Images control).
* @phpstan-param 'default'|'uploaded' $type
*/
public function show_header_selector($type = 'default')
{
Expand Down Expand Up @@ -1354,6 +1355,7 @@ public function filter_upload_tabs($tabs)
* registered for that theme; and the key of an image uploaded for that theme
* (the attachment ID of the image). Or an array of arguments: attachment_id,
* url, width, height. All are required.
* @phpstan-param string|array{attachment_id: positive-int, url: string, width: non-negative-int, height: non-negative-int} $choice
* @phpstan-return void
*/
public final function set_header_image($choice)
Expand Down

0 comments on commit 9fc7c58

Please sign in to comment.