1 | <?php |
||
11 | class DecodeJsonBodyRequestListener implements EventSubscriberInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var ContentTypeMatcher |
||
15 | */ |
||
16 | private $contentTypeMatcher; |
||
17 | |||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $contentTypes; |
||
22 | |||
23 | /** |
||
24 | * @param ContentTypeMatcher $contentTypeMatcher |
||
25 | * @param null|string[] $contentTypes |
||
26 | */ |
||
27 | 8 | public function __construct(ContentTypeMatcher $contentTypeMatcher, array $contentTypes = null) |
|
32 | |||
33 | 8 | public function onKernelRequest(GetResponseEvent $event) |
|
44 | |||
45 | /** |
||
46 | * @param Request $request |
||
47 | */ |
||
48 | 6 | public function decodeBody(Request $request) |
|
65 | |||
66 | 2 | public static function getSubscribedEvents() |
|
70 | } |
||
71 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.