Issues (14)

src/SynchronousMessageDispatcher.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing;
6
7
final class SynchronousMessageDispatcher implements MessageDispatcher
8
{
9
    /**
10
     * @var list<MessageConsumer>
0 ignored issues
show
The type EventSauce\EventSourcing\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
     */
12
    private array $consumers;
13
14 20
    public function __construct(MessageConsumer ...$consumers)
15
    {
16 20
        $this->consumers = $consumers;
0 ignored issues
show
Documentation Bug introduced by
It seems like $consumers of type array<integer,EventSauce...urcing\MessageConsumer> is incompatible with the declared type EventSauce\EventSourcing\list of property $consumers.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
17 20
    }
18
19 12
    public function dispatch(Message ...$messages): void
20
    {
21 12
        foreach ($messages as $message) {
22 12
            foreach ($this->consumers as $consumer) {
23 11
                $consumer->handle($message);
24
            }
25
        }
26 12
    }
27
}
28