Why is PHPStorm suggesting functions that aren't available in the current language level?

I'm trying out PHP's built-in XmlElement object, and PHPStorm gives me a suggestion for ->getChildren(), but when it's added, it then shows a red underline error, upon which hovering shows that it's only available for a future version of PHP, which I'm not using.

Why is the editor even giving me the suggestion to begin with? This is frustrating. It shouldn't be showing pointless suggestions.

I think hasChildren is also not available to the version I'm using, which I'm guessing why it's in red, but why even show this?

Either I didn't notice before that getChildren was red, but I don't remember it being highlighted like that, and there's no clear indication anywhere in the suggestion box that it's not actually available to use.

评论操作 固定链接

There's no particular reason for that, it's a usability problem that has to be fixed. Here's the corresponding report on our tracker:
https://youtrack.jetbrains.com/issue/WI-62475

1

请先登录再写评论。