-
Notifications
You must be signed in to change notification settings - Fork 74
Introduce PHPStan for Static Analysis #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
8afa39c
cf4fa9f
d80987b
019232b
56c218c
1a12b1f
85d8176
487df5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: PHPStan CI | ||
|
|
||
| on: [push] | ||
|
|
||
| jobs: | ||
| build-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - name: Install dependencies | ||
| uses: php-actions/composer@v6 | ||
| with: | ||
| php_version: '7.2' | ||
| - name: Run PHPStan | ||
| uses: php-actions/phpstan@v3 | ||
| with: | ||
| version: 'composer' | ||
| php_version: '7.2' | ||
| memory_limit: 1G |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| includes: | ||
| - vendor/szepeviktor/phpstan-wordpress/extension.neon | ||
| parameters: | ||
| level: 0 | ||
| paths: | ||
| - wp-multi-network/includes | ||
| - wpmn-loader.php | ||
| ignoreErrors: | ||
| - '/^Call to static method add_command\(\) on an unknown class WP_CLI.$/' | ||
| - '/^Call to static method encode\(\) on an unknown class Requests_IDNAEncoder.$/' | ||
| - '/^Call to static method error\(\) on an unknown class WP_CLI.$/' | ||
| - '/^Call to static method success\(\) on an unknown class WP_CLI.$/' | ||
| - '/^Call to static method warning\(\) on an unknown class WP_CLI.$/' | ||
| - '/^Function WP_CLI\\Utils\\get_flag_value not found.$/' | ||
| - '/^Function WP_CLI\\Utils\\get_plugin_name not found.$/' | ||
| - '/^Instantiated class WP_CLI\\Fetchers\\Plugin not found.$/' | ||
| - '/^Instantiated class WP_CLI\\Fetchers\\User not found.$/' | ||
| - '/^Instantiated class WP_CLI\\Formatter not found.$/' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| * | ||
| * @since 1.3.0 | ||
| */ | ||
| class WP_MS_Network_Command extends WP_CLI_Command { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Historically, WP-CLI provided a base WP_CLI_Command class to extend, however extending this class is not required and will not change how your command behaves. https://make.wordpress.org/cli/handbook/guides/commands-cookbook/ |
||
| class WP_MS_Network_Command { | ||
|
|
||
| /** | ||
| * Default fields to display for each object. | ||
|
|
@@ -260,7 +260,7 @@ public function list_( $args, $assoc_args ) { | |
| * @param array $assoc_args Associative CLI arguments. | ||
| */ | ||
| public function plugin( $args, $assoc_args ) { | ||
| $this->fetcher = new \WP_CLI\Fetchers\Plugin(); | ||
| $fetchers_plugin = new \WP_CLI\Fetchers\Plugin(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that this should be a var and not a class member (PHPStan also didn't like it :-)) |
||
| $action = array_shift( $args ); | ||
| if ( ! in_array( $action, array( 'activate', 'deactivate' ), true ) ) { | ||
| WP_CLI::error( sprintf( '%s is not a supported action.', $action ) ); | ||
|
|
@@ -284,7 +284,7 @@ function ( $file ) { | |
| }, array_keys( get_plugins() ) | ||
| ); | ||
| } | ||
| foreach ( $this->fetcher->get_many( $args ) as $plugin ) { | ||
| foreach ( $fetchers_plugin->get_many( $args ) as $plugin ) { | ||
| $status = $this->get_status( $plugin->file ); | ||
| if ( $all && in_array( $status, array( 'active', 'active-network' ), true ) ) { | ||
| --$needing_activation; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -449,10 +449,6 @@ public function update_item( $request ) { | |
| } | ||
|
|
||
| if ( ! empty( $prepared_args ) ) { | ||
| if ( is_wp_error( $prepared_args ) ) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already sorted out at line 447. |
||
| return $prepared_args; | ||
| } | ||
|
|
||
| $domain = $prepared_args['domain']; | ||
| $path = $prepared_args['path']; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.