php-stubs / wordpress-stubs

Up-to-date WordPress function and class declaration stubs for static analysis by PHPStan
https://packagist.org/packages/php-stubs/wordpress-stubs
MIT License
146 stars 18 forks source link

Add stubs for WP 6.5 #167

Closed IanDelMar closed 5 months ago

IanDelMar commented 5 months ago

This pull request updates the stubs to WordPress 6.5.

Changes to functionMap.php:

Notes:

Concerning the idea of ceasing to add additional tags if a tag with the same name is already present (#163):

szepeviktor commented 5 months ago

Thank you Ian! Could you please regenerate stubs for the latest tag without adding 6.5?

szepeviktor commented 5 months ago

You know what?!

IanDelMar commented 5 months ago

Thank you Ian! Could you please regenerate stubs for the latest tag without adding 6.5?

Sorry, didn't see this before. Anything you still want me to do?

szepeviktor commented 5 months ago

No. Everything is released.

swissspidy commented 5 months ago

@IanDelMar Thanks for working on this! Would you mind creating core trac tickets for those two functions?

IanDelMar commented 5 months ago

@swissspidy Feel free to do it on my behalf 🙈

szepeviktor commented 5 months ago

Feel free to do it on my behalf

After all Pascal is our secret connection to WordPress!

swissspidy commented 5 months ago
  • wp_get_avif_info(): The visitor no longer includes additions stemming from @type, possibly due to incorrect indentation. This should be addressed in the core.
  • wp_enqueue_script_module(): See to wp_get_avif_info().

So I just looked into those. Unfortunately, this non-standard phpdoc format for arrays is part of the WordPress coding standards. It's not limited to these two function; just search the code base for @return array { and you'll find lots of examples. We'll have to work around this or make a proposal for core to change its standards or add @phpstan-* tags in addition to those 🤷 😞

szepeviktor commented 5 months ago

add @phpstan-* tags

Yes. Please have core add ALL of our tags in functionMap.

IanDelMar commented 5 months ago

We'll have to work around this

The visitor is aware of this notation for arrays! However, according to the WordPress coding standards, it should be indented by 4 spaces or a multiple thereof. This is what the visitor is seeking but can't find for these two functions. Therefore, it should be fixed in WP core.

search the code base for @return array { and you'll find lots of examples.

And in many of these cases, the phpstan tag is added correctly.

swissspidy commented 5 months ago

Oh, ok! Let me take another look next week then

swissspidy commented 5 months ago

Alright, https://core.trac.wordpress.org/changeset/58037 should fix this

IanDelMar commented 5 months ago

Alright, https://core.trac.wordpress.org/changeset/58037 should fix this

These haven't made it into core yet, right?

swissspidy commented 5 months ago

That‘s in core :) just not in a published release. That will be WP 6.6, due out this summer