1 | <?php |
||
2 | namespace src; |
||
3 | |||
4 | use |
||
5 | src\ |
||
6 | {Sexo, |
||
0 ignored issues
–
show
|
|||
7 | Edad, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\Edad . 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.
![]() |
|||
8 | RangoDeEdad, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\RangoDeEdad . 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.
![]() |
|||
9 | EstadoCivil, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\EstadoCivil . 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.
![]() |
|||
10 | NivelDeEstudios, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\NivelDeEstudios . 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.
![]() |
|||
11 | Ocupacion, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\Ocupacion . 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.
![]() |
|||
12 | Departamento, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\Departamento . 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.
![]() |
|||
13 | TipoDePuesto, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\TipoDePuesto . 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.
![]() |
|||
14 | TipoDeContratacion, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\TipoDeContratacion . 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.
![]() |
|||
15 | TipoDePersonal, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\TipoDePersonal . 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.
![]() |
|||
16 | TipoDeJornada, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\TipoDeJornada . 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.
![]() |
|||
17 | RealizaRotacion, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\RealizaRotacion . 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.
![]() |
|||
18 | RangoTiempoEnPuesto, |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\RangoTiempoEnPuesto . 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.
![]() |
|||
19 | RangoExperienciaLaboral}; |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
src\RangoExperienciaLaboral . 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.
![]() |
|||
20 | |||
21 | class Trabajador |
||
22 | { |
||
23 | private $_sexo; |
||
24 | private $_edad; |
||
25 | private $_rangoDeEdad; |
||
26 | private $_estadoCivil; |
||
27 | private $_nivelDeEstudios; |
||
28 | private $_ocupacion; |
||
29 | private $_departamento; |
||
30 | private $_tipoDePuesto; |
||
31 | private $_tipoDeContratacion; |
||
32 | private $_tipoDePersonal; |
||
33 | private $_tipoDeJornada; |
||
34 | private $_realizaRotacion; |
||
35 | private $_rangoTiempoEnPuesto; |
||
36 | private $_rangoExperienciaLaboral; |
||
37 | |||
38 | public function __construct |
||
39 | ( |
||
40 | Sexo $Sexo, |
||
41 | Edad $Edad, |
||
42 | RangoDeEdad $RangoDeEdad, |
||
43 | EstadoCivil $EstadoCivil, |
||
44 | NivelDeEstudios $NivelDeEstudios, |
||
45 | Ocupacion $Ocupacion, |
||
46 | Departamento $Departamento, |
||
47 | TipoDePuesto $TipoDePuesto, |
||
48 | TipoDeContratacion $TipoDeContratacion, |
||
49 | TipoDePersonal $TipoDePersonal, |
||
50 | TipoDeJornada $TipoDeJornada, |
||
51 | RealizaRotacion $RealizaRotacion, |
||
52 | RangoTiempoEnPuesto $RangoTiempoEnPuesto, |
||
53 | RangoExperienciaLaboral $RangoExperienciaLaboral |
||
54 | ) |
||
55 | { |
||
56 | $this->_sexo = $Sexo; |
||
57 | $this->_edad = $Edad; |
||
58 | $this->_rangoDeEdad = $RangoDeEdad; |
||
59 | $this->_estadoCivil = $EstadoCivil; |
||
60 | $this->_nivelDeEstudios = $NivelDeEstudios; |
||
61 | $this->_ocupacion = $Ocupacion; |
||
62 | $this->_departamento = $Departamento; |
||
63 | $this->_tipoDePuesto = $TipoDePuesto; |
||
64 | $this->_tipoDeContratacion = $TipoDeContratacion; |
||
65 | $this->_tipoDePersonal = $TipoDePersonal; |
||
66 | $this->_tipoDeJornada = $TipoDeJornada; |
||
67 | $this->_realizaRotacion = $RealizaRotacion; |
||
68 | $this->_rangoTiempoEnPuesto = $RangoTiempoEnPuesto; |
||
69 | $this->_rangoExperienciaLaboral = $RangoExperienciaLaboral; |
||
70 | } |
||
71 | |||
72 | public function sexo(): string |
||
73 | { |
||
74 | return $this->_sexo->sexo(); |
||
75 | } |
||
76 | |||
77 | public function edad(): int |
||
78 | { |
||
79 | return $this->_edad->edad(); |
||
80 | } |
||
81 | |||
82 | public function rangoDeEdad(): string |
||
83 | { |
||
84 | return $this->_rangoDeEdad->rangoDeEdad(); |
||
85 | } |
||
86 | |||
87 | public function estadoCivil(): string |
||
88 | { |
||
89 | return $this->_estadoCivil->estadoCivil(); |
||
90 | } |
||
91 | |||
92 | public function nivelDeEstudios(): string |
||
93 | { |
||
94 | return $this->_nivelDeEstudios->nivelDeEstudios(); |
||
95 | } |
||
96 | |||
97 | public function ocupacion(): string |
||
98 | { |
||
99 | return $this->_ocupacion->ocupacion(); |
||
100 | } |
||
101 | |||
102 | public function departamento(): string |
||
103 | { |
||
104 | return $this->_departamento->departamento(); |
||
105 | } |
||
106 | |||
107 | public function tipoDePuesto(): string |
||
108 | { |
||
109 | return $this->_tipoDePuesto->tipoDePuesto(); |
||
110 | } |
||
111 | |||
112 | public function tipoDeContratacion(): string |
||
113 | { |
||
114 | return $this->_tipoDeContratacion->tipoDeContratacion(); |
||
115 | } |
||
116 | |||
117 | public function tipoDePersonal(): string |
||
118 | { |
||
119 | return $this->_tipoDePersonal->tipoDePersonal(); |
||
120 | } |
||
121 | |||
122 | public function tipoDeJornada(): string |
||
123 | { |
||
124 | return $this->_tipoDeJornada->tipoDeJornada(); |
||
125 | } |
||
126 | |||
127 | public function realizaRotacion(): string |
||
128 | { |
||
129 | return $this->_realizaRotacion->realizaRotacion(); |
||
130 | } |
||
131 | |||
132 | public function rangoTiempoenPuesto(): string |
||
133 | { |
||
134 | return $this->_rangoTiempoEnPuesto->rangoTiempoenPuesto(); |
||
135 | } |
||
136 | |||
137 | public function rangoExperienciaLaboral(): string |
||
138 | { |
||
139 | return $this->_rangoExperienciaLaboral->rangoExperienciaLaboral(); |
||
140 | } |
||
141 | } |
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: