phpstan-wordpress icon indicating copy to clipboard operation
phpstan-wordpress copied to clipboard

WIP: Move several extensions to WP stubs

Open IanDelMar opened this issue 1 year ago • 2 comments

Description

This pull request syncs the 2.x branch with the master branch and removes extensions whose functionality has already been implemented or is about to be implemented by php-stubs/wordpress-stubs, or is no longer needed or is incorrect:

  • EchoKeyDynamicFunctionReturnTypeExtension
  • GetApprovedCommentsDynamicFunctionReturnTypeExtension
  • GetListTableDynamicFunctionReturnTypeExtension
  • GetPostDynamicFunctionReturnTypeExtension
  • GetPostsDynamicFunctionReturnTypeExtension
  • GetSitesDynamicFunctionReturnTypeExtension
  • GetTermsDynamicFunctionReturnTypeExtension
  • WpDieDynamicFunctionReturnTypeExtension

EchoKeyDynamicFunctionReturnTypeExtension

  • Only the_title_attribute(), wp_dropdown_languages(), wp_get_archives(), wp_list_bookmarks(), wp_list_categories(), and wp_list_pages() have been transferred to php-stubs/wordpress-stubs.
  • wp_dropdown_categories(), wp_dropdown_pages(), wp_dropdown_users(), and wp_link_pages() always return a string as documented, and hence are not included in any PR porting functionality to php-stubs/wordpress-stubs.
  • The $args parameter of get_search_form(), wp_list_authors(), wp_list_comments(), wp_list_users(), wp_login_form(), and wp_page_menu() is filterable, and thus the value of $args['echo'] is unknown. TTherefore, these were excluded from the functionality ported to php-stubs/wordpress-stubs.

RedirectCanonicalDynamicFunctionReturnTypeExtension

Starting from PHPStan 1.10.49, void types, including void in unions, are transformed into null. This extension is no longer needed.

Related

PRs implementing the functionality in php-stubs/wordpress-stubs

  • https://github.com/php-stubs/wordpress-stubs/pull/127
  • https://github.com/php-stubs/wordpress-stubs/pull/195
  • https://github.com/php-stubs/wordpress-stubs/pull/197
  • https://github.com/php-stubs/wordpress-stubs/pull/198
  • https://github.com/php-stubs/wordpress-stubs/pull/199
  • https://github.com/php-stubs/wordpress-stubs/pull/200
  • https://github.com/php-stubs/wordpress-stubs/pull/201
  • https://github.com/php-stubs/wordpress-stubs/pull/202
  • https://github.com/php-stubs/wordpress-stubs/pull/209

To Do

  • [x] Check if EchoKeyDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if GetListTableDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if GetPostDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if RedirectCanonicalDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if ShortcodeAttsDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if StringOrArrayDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [x] Check if WpDieDynamicFunctionReturnTypeExtension can be implemented in WP stubs
  • [ ] Update the php-stubs/wordpress-stubs version in composer.json to the first released version that includes all the functionality of the removed extensions

IanDelMar avatar Aug 23 '24 19:08 IanDelMar

All right. Please help me review it.

szepeviktor avatar Aug 23 '24 22:08 szepeviktor

All right. Please help me review it.

Although it may not seem like it, there isn't actually much to review. This PR removes some of the extensions that have been ported to WP stubs. The remainder is simply an import of recent changes (from the last two months) in the master branch.

IanDelMar avatar Aug 24 '24 05:08 IanDelMar