OsvaldoGDelRio /
custionario-ets-nom035-stps
| 1 | <?php |
||
| 2 | namespace src; |
||
| 3 | |||
| 4 | use src\FactoryClassInterface; |
||
| 5 | |||
| 6 | use src\{ |
||
| 7 | CuestionarioEts, |
||
|
0 ignored issues
–
show
|
|||
| 8 | AcontecimientoTraumaticoSevero, |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\AcontecimientoTraumaticoSevero. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 9 | RecuerdosPersistentesSobreElAcontecimiento, |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\RecuerdosPersistentesSobreElAcontecimiento. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 10 | EsfuerzoPorEvitarCircunstanciasParecidasOAsociadasAlAcontecimiento, |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\EsfuerzoPorEvitarCir...ociadasAlAcontecimiento. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 11 | Afectacion |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\Afectacion. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 12 | }; |
||
| 13 | |||
| 14 | class CrearCuestionarioEts implements FactoryClassInterface |
||
| 15 | { |
||
| 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 | ) |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | } |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare 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.phpHowever, as
OtherDir/Foo.phpdoes 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: