Comments (9)
Let's just fix this in WordPress itself :-)
https://core.trac.wordpress.org/changeset/58268
from wordpress-stubs.
Please do not complicate this more.
It can be resolved in local stubs.
from wordpress-stubs.
diff --git a/functionMap.php b/functionMap.php
index 7065d1f..2619d5e 100644
--- a/functionMap.php
+++ b/functionMap.php
@@ -136,4 +136,5 @@ return [
'WP_Widget::form' => [null, 'instance' => 'T'],
'WP_Widget::update' => [null, 'new_instance' => 'T', 'old_instance' => 'T'],
'WP_Widget::widget' => [null, 'instance' => 'T', 'args' => 'array{name:string,id:string,description:string,class:string,before_widget:string,after_widget:string,before_title:string,after_title:string,before_sidebar:string,after_sidebar:string,show_in_rest:boolean,widget_id:string,widget_name:string}'],
+ 'block_template_part' => ['void', 'part' => 'string']
];
diff --git a/wordpress-stubs.php b/wordpress-stubs.php
index dfdea96..3a4a5d3 100644
--- a/wordpress-stubs.php
+++ b/wordpress-stubs.php
@@ -95084,6 +95084,7 @@ namespace {
*
* @param string $part The block template part to print. Either 'header' or 'footer'.
* @phpstan-param 'header'|'footer' $part
+ * @phpstan-param string $part
* @phpstan-return void
*/
function block_template_part($part)
from wordpress-stubs.
@johnbillion Do you know where @phpstan-param 'header'|'footer' $part
comes from?
Couldn't find it in this repository.
from wordpress-stubs.
@lipemat Thank you!
What is your specific $part
value?
from wordpress-stubs.
Varies per project but here are some I was testing with.
- 'test-part'
- 'gallery'
- 'latest-articles'
from wordpress-stubs.
Do you know where
@phpstan-param 'header'|'footer' $part
comes from?
wordpress-stubs/src/Visitor.php
Line 635 in a5558fc
from wordpress-stubs.
Without losing all the 'either ... or ...' constructs, we cannot fix this in the visitor except by skipping predefined functions. So there are basically two options: 1) exclude specific functions, or 2) use the function map to override tags automatically added by identifying expressions that indicate a restricted set of possible values.
from wordpress-stubs.
With 6.6 being released, this issue can be closed once the stubs are updated in this repo.
from wordpress-stubs.
Related Issues (20)
- Ondลej says: It doesn't make sense to combine void with something else in a union type. HOT 5
- Include `wp-includes/compat.php` HOT 10
- `wp_is_development_mode()` is missing from the stubs HOT 5
- wp_insert_attachment doesn't show WP_Error as possible return value HOT 5
- 6.4 new see tag HOT 9
- Tests for functionMap.php HOT 1
- Widget::widget() has never return type HOT 1
- stubs for wpdb::get_row() and wpdb::get_results() are wrong HOT 10
- Thanks HOT 1
- function wp_remote_retrieve_header expects array|WP_Error, httpReturnType given. HOT 3
- Issue with wp_get_global_stylesheet Function Not Recognized by Intelliphense HOT 2
- `add_submenu_page` parameter `$callback` should accept `''|callable` HOT 1
- function `wp_register_script` is missing `$in_footer` argument HOT 2
- The nice present: core phpstan tags vs. our phpstan tags in WordPress 6.5 HOT 10
- Update stubs to WordPress 6.5 HOT 1
- `WP_HTML_Tag_Processor::next_tag()` should accept `string` HOT 4
- PHPStan parameter type for `wp_insert_term()` not accurate in stubs. HOT 3
- No more SimplePie HOT 2
- v6.6.0 Not Showing Up in Packagist HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wordpress-stubs.