警告消息:“找不到方法getText”,仅编辑器警告*,在运行时工作

I am trying to get rid of an editor warning:

"Method 'getText' not found."

This is only an editor issue because the code works at run-time, so my assumption is that the editor is just not 'aware' of where this method is from. Therefore, I am looking for help on how to set-up the Editor to work with my PHP 7.3 interpreter and all of its libraries.

I've tried two things:

  1. Under the Language & Frameworks setting for PHP, I tried syncing "Extensions with Interpreter"
  2. Looking through some what I 'think' are similar problems on here and elsewhere, I was pointed to one, which was to enable the extension: extension=intl in my php.ini file.
$this->foo("foooooooo");
$foos = $this->getElements('//XPATH"]//a[starts-with(text(), "TEXT")]');
$selectedFoo = false;

//Choose XXX foo if it exists
foreach ($foos as $foo)
{
    $fooText = $foo->getText(); //I get the warning here

    if (substr($fooText, -3) === 'XXX')
    {
        $selectedFoo = $foo;
    }
}

I expect that the editor is able to get the reference to this method and not show a warning.

*If you believe I have not put in the adequate effort into researching this issue, please tell me so but I would appreciate being pointed into the right direction, so that I may make another attempt to solve it on my own.

I guess you can help PhpStorm by adding @var doc block:

$this->foo("foooooooo");

/** @var Behat\Mink\Element\Element[] $foos */
$foos = $this->getElements('//XPATH"]//a[starts-with(text(), "TEXT")]');

$selectedFoo = false;

//Choose XXX foo if it exists
foreach ($foos as $foo)
{
    $fooText = $foo->getText(); //I get the warning here

    if (substr($fooText, -3) === 'XXX')
    {
        $selectedFoo = $foo;
    }
}