1 | <?php |
||
12 | class Handler { |
||
13 | /** |
||
14 | * Actual handler |
||
15 | * |
||
16 | * @var array|\Closure|null |
||
17 | */ |
||
18 | protected $handler = null; |
||
19 | |||
20 | /** |
||
21 | * Constructor |
||
22 | * |
||
23 | * @param string|\Closure $handler |
||
24 | */ |
||
25 | 1 | public function __construct( $handler ) { |
|
28 | |||
29 | /** |
||
30 | * Parse a handler to a \Closure or a [class, method] array |
||
31 | * |
||
32 | * @param string|\Closure $handler |
||
33 | * @return array|\Closure|null |
||
|
|||
34 | */ |
||
35 | 5 | protected function parse( $handler ) { |
|
46 | |||
47 | /** |
||
48 | * Parse a string handler to a [class, method] array |
||
49 | * |
||
50 | * @param string $handler |
||
51 | * @return array|\Closure|null |
||
52 | */ |
||
53 | 3 | protected function parseFromString( $handler ) { |
|
65 | |||
66 | /** |
||
67 | * Get the handler |
||
68 | * |
||
69 | * @return array|\Closure|null |
||
70 | */ |
||
71 | 1 | public function get() { |
|
74 | |||
75 | /** |
||
76 | * Set the handler |
||
77 | * |
||
78 | * @param string|\Closure $new_handler |
||
79 | * @return null |
||
80 | */ |
||
81 | 6 | public function set( $new_handler ) { |
|
90 | |||
91 | /** |
||
92 | * Execute the handler returning raw result |
||
93 | * |
||
94 | * @return string|array|\Psr\Http\Message\ResponseInterface |
||
95 | */ |
||
96 | 2 | protected function executeHandler() { |
|
108 | |||
109 | /** |
||
110 | * Execute the handler |
||
111 | * |
||
112 | * @return \Psr\Http\Message\ResponseInterface |
||
113 | */ |
||
114 | 5 | public function execute() { |
|
127 | } |
||
128 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.