1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Limoncello\Testing; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015-2020 [email protected] |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Closure; |
22
|
|
|
use Limoncello\Contracts\Core\ApplicationInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @package Limoncello\Testing |
26
|
|
|
*/ |
27
|
|
|
interface ApplicationWrapperInterface extends ApplicationInterface |
28
|
|
|
{ |
29
|
|
|
/** Called right before request will be passed through all middleware, controller and back */ |
30
|
|
|
const EVENT_ON_HANDLE_REQUEST = 0; |
31
|
|
|
|
32
|
|
|
/** Called when response has passed back all middleware right before sending to client */ |
33
|
|
|
const EVENT_ON_HANDLE_RESPONSE = self::EVENT_ON_HANDLE_REQUEST + 1; |
34
|
|
|
|
35
|
|
|
/** Called on empty container created (before it's set up) */ |
36
|
|
|
const EVENT_ON_CONTAINER_CREATED = self::EVENT_ON_HANDLE_RESPONSE + 1; |
37
|
|
|
|
38
|
|
|
/** Called right before controller is called */ |
39
|
|
|
const EVENT_ON_CONTAINER_LAST_CONFIGURATOR = self::EVENT_ON_CONTAINER_CREATED + 1; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param Closure $handler |
43
|
|
|
* |
44
|
|
|
* @return self |
|
|
|
|
45
|
|
|
*/ |
46
|
|
|
public function addOnHandleRequest(Closure $handler): self; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param Closure $handler |
50
|
|
|
* |
51
|
|
|
* @return self |
|
|
|
|
52
|
|
|
*/ |
53
|
|
|
public function addOnHandleResponse(Closure $handler): self; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param Closure $handler |
57
|
|
|
* |
58
|
|
|
* @return self |
|
|
|
|
59
|
|
|
*/ |
60
|
|
|
public function addOnContainerCreated(Closure $handler): self; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param Closure $handler |
64
|
|
|
* |
65
|
|
|
* @return self |
|
|
|
|
66
|
|
|
*/ |
67
|
|
|
public function addOnContainerLastConfigurator(Closure $handler): self; |
68
|
|
|
} |
69
|
|
|
|
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.