1 | <?php |
||
13 | class App |
||
14 | { |
||
15 | /** |
||
16 | * Dependency Injection container. |
||
17 | * |
||
18 | * @var ContainerInterface |
||
19 | */ |
||
20 | private $container; |
||
21 | |||
22 | /** |
||
23 | * Application initialization. |
||
24 | * |
||
25 | * @param ContainerInterface $container Dependency Injection container. |
||
26 | * |
||
27 | * @throws Exception If no router is defined. |
||
28 | */ |
||
29 | 36 | public function __construct(ContainerInterface $container = null) |
|
41 | |||
42 | /** |
||
43 | * Container getter. |
||
44 | * |
||
45 | * @return ContainerInterface |
||
46 | */ |
||
47 | 36 | public function getContainer() |
|
51 | |||
52 | /** |
||
53 | * Penny dispatcher getter. |
||
54 | * |
||
55 | * @return Dispatcher |
||
56 | */ |
||
57 | 30 | private function getDispatcher() |
|
66 | |||
67 | /** |
||
68 | * Penny HTTP flow event getter. |
||
69 | * |
||
70 | * @return EventManager |
||
71 | */ |
||
72 | 28 | private function getEventManager() |
|
76 | |||
77 | /** |
||
78 | * Application execution. |
||
79 | * |
||
80 | * @param mixed|null $request Representation of an outgoing, |
||
81 | * client-side request. |
||
82 | * @param mixed|null $response Representation of an incoming, |
||
83 | * server-side response. |
||
84 | * |
||
85 | * @return mixed |
||
86 | */ |
||
87 | 32 | public function run($request = null, $response = null) |
|
132 | |||
133 | /** |
||
134 | * Event Manager trigger with exception |
||
135 | * |
||
136 | * @param \Zend\EventManager\EventManager|\Cake\Event\EventManager $eventManager |
||
137 | * @param PennyEventInterface|\Zend\EventManager\EventInterface|\Cake\Event\Event $event |
||
138 | * @param string $name |
||
139 | * @param Exception $exception |
||
140 | * |
||
141 | * @return PennyEventInterface|\Zend\EventManager\EventInterface|\Cake\Event\Event |
||
142 | */ |
||
143 | 10 | private function triggerWithException($eventManager, $event, $name, Exception $exception) |
|
151 | } |
||
152 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: