1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Ray.AuraSqlModule package |
4
|
|
|
* |
5
|
|
|
* @license http://opensource.org/licenses/bsd-license.php MIT |
6
|
|
|
*/ |
7
|
|
|
namespace Ray\WebContextParam; |
8
|
|
|
|
9
|
|
|
use Doctrine\Common\Annotations\AnnotationReader; |
10
|
|
|
use Doctrine\Common\Annotations\Reader; |
11
|
|
|
use Doctrine\Common\Cache\ArrayCache; |
12
|
|
|
use Doctrine\Common\Cache\Cache; |
13
|
|
|
use Ray\Di\AbstractModule; |
14
|
|
|
use Ray\Di\Scope; |
15
|
|
|
use Ray\WebContextParam\Annotation\CookieParam; |
16
|
|
|
use Ray\WebContextParam\Annotation\EnvParam; |
17
|
|
|
use Ray\WebContextParam\Annotation\FormParam; |
18
|
|
|
use Ray\WebContextParam\Annotation\QueryParam; |
19
|
|
|
use Ray\WebContextParam\Annotation\ServerParam; |
20
|
|
|
|
21
|
|
|
class WebContextParamModule extends AbstractModule |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* {@inheritdoc} |
25
|
|
|
*/ |
26
|
1 |
|
protected function configure() |
27
|
|
|
{ |
28
|
1 |
|
$this->bindInterceptor( |
29
|
1 |
|
$this->matcher->any(), |
30
|
1 |
|
$this->matcher->logicalOr( |
31
|
1 |
|
$this->matcher->annotatedWith(QueryParam::class), |
32
|
1 |
|
$this->matcher->annotatedWith(CookieParam::class), |
33
|
1 |
|
$this->matcher->annotatedWith(FormParam::class), |
|
|
|
|
34
|
1 |
|
$this->matcher->annotatedWith(EnvParam::class), |
35
|
1 |
|
$this->matcher->annotatedWith(ServerParam::class) |
36
|
1 |
|
), |
37
|
1 |
|
[WebContextParamInterceptor::class] |
38
|
1 |
|
); |
39
|
1 |
|
$this->bind(Reader::class)->to(AnnotationReader::class)->in(Scope::SINGLETON); |
40
|
1 |
|
$this->bind(Cache::class)->to(ArrayCache::class)->in(Scope::SINGLETON); |
41
|
1 |
|
$this->bind(WebContext::class); |
42
|
1 |
|
} |
43
|
|
|
} |
44
|
|
|
|
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.