It seems like $productTaxon->getProduct() can also be of type null; however, parameter $resource of BitBag\SyliusElasticsear...herInterface::refresh() does only seem to accept Sylius\Component\Resource\Model\ResourceInterface, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation