Passed
Push — master ( c541cb...64a56e )
by Chris
33s
created

TicketAvailability::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace ConferenceTools\Tickets\Service\Factory\Service;
5
6
7
use Doctrine\ORM\EntityManager;
8
use ConferenceTools\Tickets\Domain\Service\Configuration;
9
use ConferenceTools\Tickets\Domain\Service\TicketAvailability\TicketAvailability as TicketAvailabilityService;
10
use ConferenceTools\Tickets\Domain\Service\TicketAvailability\TicketTypeFilter;
11
use ConferenceTools\Tickets\Finder\TicketCounter;
12
use Zend\ServiceManager\FactoryInterface;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
15
class TicketAvailability implements FactoryInterface
16
{
17
    public function createService(ServiceLocatorInterface $serviceLocator)
18
    {
19
        return new TicketAvailabilityService(
20
            new TicketTypeFilter($serviceLocator->get(Configuration::class)),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\Co...e\Configuration::class) is of type object|array, but the function expects a object<ConferenceTools\T...\Service\Configuration>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
21
            new TicketCounter($serviceLocator->get(EntityManager::class))
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\Do...M\EntityManager::class) is of type object|array, but the function expects a object<Doctrine\ORM\EntityManager>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
22
        );
23
    }
24
}