These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace GBProd; |
||
4 | |||
5 | use Elastica\Client; |
||
6 | use Interop\Container\ContainerInterface; |
||
7 | use Interop\Container\ServiceProvider; |
||
8 | |||
9 | /** |
||
10 | * Service provider for Elastica |
||
11 | * |
||
12 | * @author GBProd <[email protected]> |
||
13 | */ |
||
14 | class ElasticaServiceProvider implements ServiceProvider |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | private $suffix; |
||
20 | |||
21 | /** |
||
22 | * @param string $suffix |
||
0 ignored issues
–
show
|
|||
23 | */ |
||
24 | 2 | public function __construct($suffix = null) |
|
25 | { |
||
26 | 2 | $this->suffix = $suffix ? '.'.$suffix : ''; |
|
27 | 2 | } |
|
28 | |||
29 | /** |
||
30 | * {inheritdoc} |
||
31 | */ |
||
32 | public function getServices() |
||
33 | { |
||
34 | return [ |
||
35 | 2 | Client::class.$this->suffix => function (ContainerInterface $container) { |
|
36 | 2 | return new Client([ |
|
37 | 2 | 'host' => $container->get(Client::class.$this->suffix.'.host'), |
|
38 | 2 | 'port' => $container->get(Client::class.$this->suffix.'.port') |
|
39 | ]); |
||
40 | 2 | } |
|
41 | ]; |
||
42 | } |
||
43 | } |
||
44 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.