GithubHelp home page GithubHelp logo

Comments (9)

swissspidy avatar swissspidy commented on August 25, 2024 3

Let's just fix this in WordPress itself :-)

https://core.trac.wordpress.org/changeset/58268

from wordpress-stubs.

szepeviktor avatar szepeviktor commented on August 25, 2024 1

Please do not complicate this more.
It can be resolved in local stubs.

from wordpress-stubs.

szepeviktor avatar szepeviktor commented on August 25, 2024
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.

szepeviktor avatar szepeviktor commented on August 25, 2024

@johnbillion Do you know where @phpstan-param 'header'|'footer' $part comes from?
Couldn't find it in this repository.

from wordpress-stubs.

szepeviktor avatar szepeviktor commented on August 25, 2024

@lipemat Thank you!
What is your specific $part value?

from wordpress-stubs.

lipemat avatar lipemat commented on August 25, 2024

Varies per project but here are some I was testing with.

  1. 'test-part'
  2. 'gallery'
  3. 'latest-articles'

from wordpress-stubs.

szepeviktor avatar szepeviktor commented on August 25, 2024

Do you know where @phpstan-param 'header'|'footer' $part comes from?

$matched = preg_match("#(?>returns|either|one of|accepts|values are|:) ('.+'),? (?>or|and) '([^']+)'#i", $fullDescription, $matches);

from wordpress-stubs.

IanDelMar avatar IanDelMar commented on August 25, 2024

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.

swissspidy avatar swissspidy commented on August 25, 2024

With 6.6 being released, this issue can be closed once the stubs are updated in this repo.

from wordpress-stubs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.