Repository navigation
Docs: Add PHPStan types for optional callback parameters #13890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f8b11d7
bffd9e1
6103aaa
9444ff6
8e75370
8b7e501
906c4f2
3cf0176
e69d1fe
0bbddb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,15 +18,19 @@ class Custom_Background { | |
| * Callback for administration header. | ||
| * | ||
| * @since 3.0.0 | ||
| * @var callable | ||
| * @var callable|string|null | ||
| * | ||
| * @phpstan-var ''|(callable(): mixed)|null | ||
| */ | ||
| public $admin_header_callback; | ||
|
|
||
| /** | ||
| * Callback for header div. | ||
| * | ||
| * @since 3.0.0 | ||
| * @var callable | ||
| * @var callable|string|null | ||
| * | ||
| * @phpstan-var ''|(callable(): mixed)|null | ||
| */ | ||
| public $admin_image_div_callback; | ||
|
|
||
|
|
@@ -43,10 +47,13 @@ class Custom_Background { | |
| * | ||
| * @since 3.0.0 | ||
| * | ||
| * @param callable $admin_header_callback Optional. Administration header callback. | ||
| * Default empty string. | ||
| * @param callable $admin_image_div_callback Optional. Custom image div output callback. | ||
| * Default empty string. | ||
| * @param callable|string|null $admin_header_callback Optional. Administration header callback. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 Comment by Claude Opus 5.5 Nit: |
||
| * Empty string or null for none. Default empty string. | ||
| * @param callable|string|null $admin_image_div_callback Optional. Custom image div output callback. | ||
| * Empty string or null for none. Default empty string. | ||
| * | ||
| * @phpstan-param ''|(callable(): mixed)|null $admin_header_callback | ||
| * @phpstan-param ''|(callable(): mixed)|null $admin_image_div_callback | ||
| */ | ||
| public function __construct( $admin_header_callback = '', $admin_image_div_callback = '' ) { | ||
| $this->admin_header_callback = $admin_header_callback; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ I understand that
stringis needed here to account for the empty string case. Otherwise,callable|nullwould be sufficient since that includescallable-string.