Hi,

I found an issue with this test:

<?php
    declare(strict_types=1);

    namespace Devsense\Common;

    abstract class AbstractLogger
    {
        /**
         * @var static[]
         */
        protected array $_loggers = [];
    }

    final class LoggerA extends AbstractLogger
    {
        public function log(string $message): static
        {
            foreach($this->_loggers as $logger) {
                $logger->log('123');
            }

            return $this;
        }
    }

    final class LoggerB extends AbstractLogger
    {
        public function log(int $code): static
        {
            foreach($this->_loggers as $logger) {
                $logger->log(123);
            }

            return $this;
        }
    }

Maybe related to https://community.devsense.com/d/918-bad-variable-type-with-iterator-interface-and-static-type

Thank you for the fix.

Davidd ok and? why you send me this message? I am French so my english is not good, sorry.
Anyway, I found a bug/issue/... something which does not work as expected.

I always try to give you a comon/generic test to reproduce and allowing you to create a unit test.

    19 days later

    Jean-FrancoisHIVERT finally we have done some improvements allowing to resolve static in this context correctly.

    It will take a few more days before we release a pre-release.

      9 days later
      Write a Reply...