ApiHelper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 14
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Helper;
13
14
use Ivory\GoogleMap\Helper\Event\ApiEvent;
15
use Ivory\GoogleMap\Helper\Event\ApiEvents;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class ApiHelper extends AbstractHelper
21
{
22
    /**
23
     * @param object[] $objects
24
     *
25
     * @return string
26
     */
27
    public function render(array $objects)
28
    {
29
        $this->getEventDispatcher()->dispatch($event = new ApiEvent($objects), ApiEvents::JAVASCRIPT);
0 ignored issues
show
Documentation introduced by
$event = new \Ivory\Goog...vent\ApiEvent($objects) is of type object<Ivory\GoogleMap\Helper\Event\ApiEvent>, but the function expects a object<Symfony\Contracts\EventDispatcher\object>.

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...
30
31
        return $event->getCode();
32
    }
33
}
34