1 | <?php |
||
17 | class Responder implements ResponderContract |
||
18 | { |
||
19 | /** |
||
20 | * |
||
21 | * |
||
22 | * @var ResponseFactory |
||
23 | */ |
||
24 | protected $successFactory; |
||
25 | |||
26 | /** |
||
27 | * |
||
28 | * |
||
29 | * @var ResponseFactory |
||
30 | */ |
||
31 | protected $errorFactory; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param ResponseFactory $successFactory |
||
37 | * @param ResponseFactory $errorFactory |
||
38 | */ |
||
39 | public function __construct( ResponseFactory $successFactory, ResponseFactory $errorFactory ) |
||
44 | |||
45 | /** |
||
46 | * Generate a successful JSON response. |
||
47 | * |
||
48 | * @param mixed $data |
||
49 | * @param int $statusCode |
||
50 | * @param array $meta |
||
51 | * @return JsonResponse |
||
52 | */ |
||
53 | public function success( $data = null, $statusCode = 200, array $meta = [ ] ):JsonResponse |
||
63 | |||
64 | /** |
||
65 | * Generate an unsuccessful JSON response. |
||
66 | * |
||
67 | * @param string $errorCode |
||
68 | * @param int $statusCode |
||
69 | * @param mixed $message |
||
70 | * @return JsonResponse |
||
71 | */ |
||
72 | public function error( string $errorCode, int $statusCode = 500, $message = null ):JsonResponse |
||
76 | } |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.