-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix problems reported by static analysis #19
base: develop
Are you sure you want to change the base?
Conversation
if ( apply_filters( 'wp_theme_migrator_skip_during_cron', true, $this ) ) { | ||
if ( apply_filters( 'wp_theme_migrator_skip_during_cron', true, $this->wp ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need a WP
instance not a Controller
* @param Controller $this Controller instance. | ||
* @param Controller $instance Controller instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter naming
remove_action( 'registered_post_type', [ $this, 'add_post_type_query_vars' ], 10, 2 ); | ||
remove_action( 'registered_post_type', [ $this, 'add_post_type_query_vars' ], 10 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only add_action
has that last one
if ( false !== $post_type_object->query_var && $this->wp && is_post_type_viewable( $post_type_object ) ) { | ||
if ( false !== $post_type_object->query_var && is_post_type_viewable( $post_type_object ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->wp
is always set in the constructor
} | ||
|
||
return true; | ||
return wp_get_theme( $theme )->exists(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wp_get_theme
always returns a WP_Theme
instance
return wp_get_theme( $theme )?->get( 'Name' ) ?? ''; | ||
return wp_get_theme( $theme )->get( 'Name' ) ?: ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the get
method may return false but never null
Summary
@emilyatmobtown Please see individual comments.
Please consider introducing PHPStan in Alley.https://github.com/alleyinteractive/.github/blob/main/.github/workflows/php-code-quality.yml#L7