"Undefined class" after "is_callable()" check intention or bug?

I'm using PHPStorm EAP 2021.1 - in one file I'm using the following code:

Problem 1: "undefined class"

if ( is_callable( 'comet_cache::wipe' ) ) {
    comet_cache::wipe();
}

Because there's no `comet_cache` class in my dev environment, PHPStorm adds a warning "Undefined class: 'comet_cache'". It seems, that PHPStorm does not recognize the `is_callable()` condition. Is there a way to make PHPStorm honor the condition, or is this a bug?

Problem 2: "undefined namespace"

A very similar issue happens when using `class_exists( '\namespace\class' )`. PHPStorm tells me, that the namespace does not exist, which is incorrect - when the code reaches the inside of the condition, the namespace exists.

if ( class_exists( '\WPaaS\Cache' ) ) {
\WPaaS\Cache::ban();
}

0

We just don't analyze is_callable() calls yet. Please vote for the report: https://youtrack.jetbrains.com/issue/WI-51395

1

Thanks for the clarification, Eugene Morozov

Btw: I've updated my post with a second problem (I did not see your reply when I updated the post). There's a similar problem with "undefined namespace" warnings. Do you have any feedback on that as well?  

0

The same kind of feedback, unfortunately - it has to be fixed on our side: https://youtrack.jetbrains.com/issue/WI-59113

1

请先登录再写评论。