Searcher::search()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace ClientBundle\Searcher;
4
5
use ClientBundle\Repository\ClientRepository;
6
7
/**
8
 * Class Searcher
9
 */
10
class Searcher
11
{
12
    private $repository;
13
14
    /**
15
     * Searcher constructor.
16
     * @param ClientRepository $repository
17
     */
18
    public function __construct(ClientRepository $repository)
19
    {
20
        $this->repository = $repository;
21
    }
22
23
    /**
24
     * @param string $tags
25
     * @return array
26
     */
27
    public function search($tags)
28
    {
29
        return $this->repository->getIdArrayByTags($tags);
0 ignored issues
show
Documentation introduced by
$tags is of type string, but the function expects a object<ClientBundle\Entity\Tags>.

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
}
32