Issues (2551)

src/Impl/JobExecutor/ProcessEventJobHandler.php (2 issues)

Labels
1
<?php
2
3
namespace Jabe\Impl\JobExecutor;
4
5
use Jabe\Impl\Interceptor\CommandContext;
6
use Jabe\Impl\Persistence\Entity\{
7
    EventSubscriptionEntity,
8
    ExecutionEntity,
9
    JobEntity
10
};
11
12
class ProcessEventJobHandler implements JobHandlerInterface
13
{
14
    public const TYPE = "event";
15
16
    public function getType(): string
17
    {
18
        return self::TYPE;
19
    }
20
21
    public function execute(JobHandlerConfigurationInterface $configuration, ExecutionEntity $execution, CommandContext $commandContext, ?string $tenantId): void
22
    {
23
        // lookup subscription:
24
        $eventSubscriptionId = $configuration->getEventSubscriptionId();
0 ignored issues
show
The method getEventSubscriptionId() does not exist on Jabe\Impl\JobExecutor\Jo...rConfigurationInterface. It seems like you code against a sub-type of Jabe\Impl\JobExecutor\Jo...rConfigurationInterface such as Jabe\Impl\JobExecutor\Ev...riptionJobConfiguration. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        /** @scrutinizer ignore-call */ 
25
        $eventSubscriptionId = $configuration->getEventSubscriptionId();
Loading history...
25
        $eventSubscription = $commandContext->getEventSubscriptionManager()
26
            ->findEventSubscriptionById($eventSubscriptionId);
27
28
        // if event subscription is null, ignore
29
        if ($eventSubscription !== null) {
30
            $eventSubscription->eventReceived(null, false);
0 ignored issues
show
The call to Jabe\Impl\Persistence\En...Entity::eventReceived() has too few arguments starting with businessKey. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
            $eventSubscription->/** @scrutinizer ignore-call */ 
31
                                eventReceived(null, false);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
31
        }
32
    }
33
34
    public function newConfiguration(string $canonicalString): JobHandlerConfigurationInterface
35
    {
36
        return new EventSubscriptionJobConfiguration($canonicalString);
37
    }
38
39
    public function onDelete(JobHandlerConfigurationInterface $configuration, JobEntity $jobEntity): void
40
    {
41
        // do nothing
42
    }
43
}
44