-
Notifications
You must be signed in to change notification settings - Fork 95
PHPStan level 9 #536
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
base: main
Are you sure you want to change the base?
PHPStan level 9 #536
Conversation
8f14b59
to
7a36e2a
Compare
*/ | ||
protected function _url( $args, $callback ) { | ||
foreach ( $args as $obj_id ) { | ||
$object = $this->fetcher->get_check( $obj_id ); |
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 fetcher
property didn't even exist on this abstract class, and in the extending classes it was private
. So this code never worked. Plus it was never used, so it's safe to remove.
@@ -182,10 +182,6 @@ public function create( $args, $assoc_args ) { | |||
$assoc_args['post_category'] = $this->get_category_ids( $assoc_args['post_category'] ); | |||
} | |||
|
|||
if ( isset( $assoc_args['meta_input'] ) && Utils\wp_version_compare( '4.4', '<' ) ) { |
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.
Figured with our move to WP 4.9+ we can remove this compat code.
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
if ( false === $items || is_wp_error( $items ) ) { | ||
if ( false === $items ) { |
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.
Is it impossible here to end up with a WP_Error
? Relying on the docblocks is not enough, and I'm seeing that multiple filters are involved... 🤔
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.
There is no code path in there that returns WP_Error, I already checked.
Filters can always be abused, but we can‘t check for every possible return value.
git blame was unfortunately not helpful here (mangled history)
if ( ! $menu || is_wp_error( $menu ) ) { | ||
if ( false === $menu ) { |
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.
Same here re. WP_Error
. I'm assuming there was a reason why that particular check was in there?
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.
I don't think so.
It was originally introduced in 246a8bc, but without any test coverage or so.
Like in the other cases, this function never returns a WP_Error
*/ | ||
public function remove( $args, $assoc_args ) { | ||
|
||
list( $menu, $location ) = $args; | ||
|
||
$menu = wp_get_nav_menu_object( $menu ); | ||
if ( ! $menu || is_wp_error( $menu ) ) { |
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.
Same here re. WP_Error
.
Blocked by: