@JakubMisek Maybe I am wrong but I think this bug is related to the cache issue when we use SSH/WSL plugin for VSCode.
I tried to reproduce the same bug with a simple test but I can not.
I just see difference between type:
In my production code:

We have the template O in the type list, + the default type @templace O of ApiInterface, + the final type
In the example that I try to reproduce:

We just have the final type.
Example test:
<?php
declare(strict_types=1);
namespace Devsense\Generics\Interfaces;
use ArrayObject;
use stdClass;
interface MainInterface {}
interface InterfaceA extends MainInterface
{
public function contains(stdClass $store): bool;
public function methodA(): void;
}
interface InterfaceB extends MainInterface
{
public function contains(ArrayObject $store): bool;
public function methodB(): void;
}
abstract class AbstractMain implements MainInterface {}
/**
* @template T of MainInterface
*/
abstract class AbstractStore implements MainInterface
{
/**
* @var T[]
*/
public array $store;
}
final class A extends AbstractMain implements InterfaceA
{
public function contains(stdClass $store): bool
{
return false;
}
public function methodA(): void {}
}
final class B extends AbstractMain implements InterfaceB
{
public function contains(ArrayObject $store): bool
{
return false;
}
public function methodB(): void {}
}
/**
* @extends AbstractStore<InterfaceA>
*/
final class TestA extends AbstractStore
{
public function test(): void
{
foreach($this->store as $item) {
$item->methodA();
$item->methodB();
$item->contains();
}
}
}
/**
* @extends AbstractStore<InterfaceB>
*/
final class TestB extends AbstractStore
{
public function test(): void
{
foreach($this->store as $item) {
$item->methodA();
$item->methodB();
$item->contains();
}
}
}
Why we have this difference?
For my application code, it seems we have the 3 types: default + template + final
For the example test, we just have the final type
Maybe it is due to the cache issue, I will try to run a VSCode with the application code under my Windows directly so without to use the SSH/WSL splugin.
Another note:

It does not make sense to have this resolving, the containAddress should not be found by your tool.
The AddressInterface implements ApiInterface, the ServiceInterface implements ApiInterface so how is it possible to find the containAddress from a ServiceInterface? Maybe because both implement ApiInterface and I have the cache issue but with the test example above I am not able to reproduce this behavior.