Skip to content

Commit

Permalink
Remove and update extensions to reflect new stub file (#182)
Browse files Browse the repository at this point in the history
* Remove has_filter extension

* Remove current_time extension

* Remove mysql2date extension

* Remove get_object_taxonomies extension

* Remove get_taxonomies extension

* Adapt get_post extension to new stub file

* Adapt get_comment extension to new stub file

* Fix CS

* Update composer.json

* Remove WP_Theme::get()

* Remove get_permalink extension

* Update .travis.yml

* Remove term_exists extension

* Update wp_error parameter extension

* Update GetPostDynamicFunctionReturnTypeExtension.php

* Fully remove wp_error parameter extension

* Merge get_comment extension into get_post extension

* Remove type specifiying extension and rule for `is_wp_error()`

* Update README.md

Co-authored-by: Viktor Szépe <[email protected]>

* Remove echo parameter extension

* Remove _get_list_table extension

* Revert "Remove _get_list_table extension"

This reverts commit 0191253.

* Update get_post.php

* Fix earlyTerminatingMethodCalls syntax (#173)

* Remove deprecated instanceof (#183)

* Remove deprecated `instanceof` (#184)

* Remove deprecated `instanceof`

* Remove space

Co-authored-by: Viktor Szépe <[email protected]>

* Return early

* Fix handling of fields unions

* Add tests

---------

Co-authored-by: Viktor Szépe <[email protected]>

* Remove deprecated `instanceof` (#185)

* Fix CS (#186)

* Fix CS

* Fix PHP 7.2 compat.

* Fix _get_list_table extension (#190)

* Revert "Update composer.json"

This reverts commit d15b7e1.

---------

Co-authored-by: Viktor Szépe <[email protected]>
Co-authored-by: Der Mundschenk & Compagnie <[email protected]>
  • Loading branch information
3 people authored Jul 27, 2023
1 parent 77ccee0 commit 3fec21b
Show file tree
Hide file tree
Showing 39 changed files with 307 additions and 2,038 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TravisCI configuration for szepeviktor/phpstan-wordpress

if: "branch = master"
if: "branch IN (master, 2.x)"

language: "php"
os:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ Please see [WooCommerce Stubs](https://github.com/php-stubs/woocommerce-stubs)

- Makes it possible to run PHPStan on WordPress plugins and themes
- Loads [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs) package
- Provides dynamic return type extensions for many core functions
- Provides dynamic return type extensions for functions
that are not covered in [`php-stubs/wordpress-stubs`](https://github.com/php-stubs/wordpress-stubs/blob/master/functionMap.php)
- Defines some core constants
- Handles special functions and classes e.g. `is_wp_error()`
- Validates the optional docblock that precedes a call to `apply_filters()` and treats the type of its first `@param` as certain

### Usage of an `apply_filters()` docblock
Expand Down
75 changes: 13 additions & 62 deletions extension.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
services:
-
class: SzepeViktor\PHPStan\WordPress\WpThemeGetDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\IsWpErrorFunctionTypeSpecifyingExtension
tags:
- phpstan.typeSpecifier.functionTypeSpecifyingExtension
-
class: SzepeViktor\PHPStan\WordPress\WpThemeMagicPropertiesClassReflectionExtension
tags:
Expand All @@ -15,10 +7,6 @@ services:
class: SzepeViktor\PHPStan\WordPress\EchoKeyDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\GetPermalinkDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\GetListTableDynamicFunctionReturnTypeExtension
tags:
Expand Down Expand Up @@ -47,50 +35,14 @@ services:
class: SzepeViktor\PHPStan\WordPress\GetSitesDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\GetTaxonomiesDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\GetObjectTaxonomiesDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\GetCommentDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\HasFilterDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\ShortcodeAttsDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\MySQL2DateDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\CurrentTimeDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\ApplyFiltersDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\EchoParameterDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\WPErrorParameterDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\TermExistsDynamicFunctionReturnTypeExtension
tags:
- phpstan.broker.dynamicFunctionReturnTypeExtension
-
class: SzepeViktor\PHPStan\WordPress\WpParseUrlFunctionDynamicReturnTypeExtension
tags:
Expand All @@ -110,7 +62,6 @@ services:
rules:
- SzepeViktor\PHPStan\WordPress\HookCallbackRule
- SzepeViktor\PHPStan\WordPress\HookDocsRule
- SzepeViktor\PHPStan\WordPress\IsWpErrorRule
parameters:
bootstrapFiles:
- ../../php-stubs/wordpress-stubs/wordpress-stubs.php
Expand Down Expand Up @@ -138,16 +89,16 @@ parameters:
- wp_ajax_heartbeat
- wp_ajax_nopriv_heartbeat
earlyTerminatingMethodCalls:
\Custom_Background:
- Custom_Background::wp_set_background_image
\IXR_Server:
- IXR_Server::output
\WP_Ajax_Response:
- WP_Ajax_Response::send
\WP_CLI:
- WP_CLI::error
- WP_CLI::halt
\WP_Recovery_Mode:
- WP_Recovery_Mode::redirect_protected
\WP_Sitemaps_Stylesheet:
- WP_Sitemaps_Stylesheet::render_stylesheet
Custom_Background:
- wp_set_background_image
IXR_Server:
- output
WP_Ajax_Response:
- send
WP_CLI:
- error
- halt
WP_Recovery_Mode:
- redirect_protected
WP_Sitemaps_Stylesheet:
- render_stylesheet
55 changes: 0 additions & 55 deletions src/CurrentTimeDynamicFunctionReturnTypeExtension.php

This file was deleted.

122 changes: 0 additions & 122 deletions src/EchoParameterDynamicFunctionReturnTypeExtension.php

This file was deleted.

81 changes: 0 additions & 81 deletions src/GetCommentDynamicFunctionReturnTypeExtension.php

This file was deleted.

Loading

0 comments on commit 3fec21b

Please sign in to comment.