|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the Ray.WebFormModule package. |
|
4
|
|
|
* |
|
5
|
|
|
* @license http://opensource.org/licenses/MIT MIT |
|
6
|
|
|
*/ |
|
7
|
|
|
namespace Ray\WebFormModule; |
|
8
|
|
|
|
|
9
|
|
|
use Aura\Filter\FilterFactory; |
|
10
|
|
|
use Aura\Html\HelperLocatorFactory; |
|
11
|
|
|
use Aura\Input\AntiCsrfInterface; |
|
12
|
|
|
use Aura\Input\Builder; |
|
13
|
|
|
use Aura\Input\BuilderInterface; |
|
14
|
|
|
use Aura\Input\Filter; |
|
15
|
|
|
use Aura\Input\FilterInterface; |
|
16
|
|
|
use Doctrine\Common\Annotations\AnnotationReader; |
|
17
|
|
|
use Doctrine\Common\Annotations\Reader; |
|
18
|
|
|
use Ray\AuraSessionModule\AuraSessionModule; |
|
19
|
|
|
use Ray\Di\AbstractModule; |
|
20
|
|
|
use Ray\Di\Scope; |
|
21
|
|
|
use Ray\WebFormModule\Annotation\FormValidation; |
|
22
|
|
|
use Ray\WebFormModule\Annotation\InputValidation; |
|
23
|
|
|
|
|
24
|
|
|
class AuraInputModule extends AbstractModule |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
12 |
|
protected function configure() |
|
30
|
|
|
{ |
|
31
|
12 |
|
$this->install(new AuraSessionModule); |
|
|
|
|
|
|
32
|
12 |
|
$this->bind(Reader::class)->to(AnnotationReader::class)->in(Scope::SINGLETON); |
|
33
|
12 |
|
$this->bind(BuilderInterface::class)->to(Builder::class); |
|
34
|
12 |
|
$this->bind(FilterInterface::class)->to(Filter::class); |
|
35
|
12 |
|
$this->bind(AntiCsrfInterface::class)->to(AntiCsrf::class)->in(Scope::SINGLETON); |
|
36
|
12 |
|
$this->bind(FailureHandlerInterface::class)->to(OnFailureMethodHandler::class); |
|
37
|
12 |
|
$this->bind(FailureHandlerInterface::class)->annotatedWith('vnd_error')->to(VndErrorHandler::class)->in(Scope::SINGLETON); |
|
38
|
12 |
|
$this->bind(HelperLocatorFactory::class); |
|
39
|
12 |
|
$this->bind(FilterFactory::class); |
|
40
|
12 |
|
$this->bindInterceptor( |
|
41
|
12 |
|
$this->matcher->any(), |
|
42
|
12 |
|
$this->matcher->annotatedWith(InputValidation::class), |
|
43
|
12 |
|
[InputValidationInterceptor::class] |
|
44
|
|
|
); |
|
45
|
12 |
|
$this->bindInterceptor( |
|
46
|
12 |
|
$this->matcher->any(), |
|
47
|
12 |
|
$this->matcher->annotatedWith(FormValidation::class), |
|
48
|
12 |
|
[AuraInputInterceptor::class] |
|
49
|
|
|
); |
|
50
|
12 |
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: