Conditions | 1 |
Paths | 1 |
Total Lines | 35 |
Code Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function crear(array $array): CuestionarioEts |
||
17 | { |
||
18 | $acontecimientoTraumaticoSevero = new AcontecimientoTraumaticoSevero( |
||
19 | $array['pregunta1'], |
||
20 | $array['pregunta2'], |
||
21 | $array['pregunta3'], |
||
22 | $array['pregunta4'], |
||
23 | $array['pregunta5'], |
||
24 | $array['pregunta6'] |
||
25 | ); |
||
26 | |||
27 | return new CuestionarioEts( |
||
28 | $acontecimientoTraumaticoSevero, |
||
29 | new RecuerdosPersistentesSobreElAcontecimiento( |
||
30 | $acontecimientoTraumaticoSevero, |
||
31 | $array['pregunta7'], |
||
32 | $array['pregunta8'], |
||
33 | ), |
||
34 | new EsfuerzoPorEvitarCircunstanciasParecidasOAsociadasAlAcontecimiento( |
||
35 | $acontecimientoTraumaticoSevero, |
||
36 | $array['pregunta9'], |
||
37 | $array['pregunta10'], |
||
38 | $array['pregunta11'], |
||
39 | $array['pregunta12'], |
||
40 | $array['pregunta13'], |
||
41 | $array['pregunta14'], |
||
42 | $array['pregunta15'] |
||
43 | ), |
||
44 | new Afectacion( |
||
45 | $acontecimientoTraumaticoSevero, |
||
46 | $array['pregunta16'], |
||
47 | $array['pregunta17'], |
||
48 | $array['pregunta18'], |
||
49 | $array['pregunta19'], |
||
50 | $array['pregunta20'] |
||
51 | ) |
||
54 | } |
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: