1 | <?php |
||
11 | class FormRequest extends Request |
||
12 | { |
||
13 | /** |
||
14 | * Field to identify requests originating from this library. |
||
15 | */ |
||
16 | const JS_VALIDATION_FIELD = '__proengsoft_form_request'; |
||
17 | |||
18 | /** |
||
19 | * Validate the class instance. |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | public function validateResolved() |
||
30 | |||
31 | /** |
||
32 | * Handle a passed validation attempt. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | protected function passedValidation() |
||
46 | |||
47 | /** |
||
48 | * Handle a failed validation attempt. |
||
49 | * |
||
50 | * @param \Illuminate\Contracts\Validation\Validator $validator |
||
51 | * @return void |
||
52 | * |
||
53 | * @throws \Illuminate\Validation\ValidationException |
||
54 | */ |
||
55 | protected function failedValidation(Validator $validator) |
||
66 | |||
67 | /** |
||
68 | * Whether the request originated from laravel-jsvalidation. |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | private function isJsValidation() |
||
76 | } |
||
77 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: