1 | <?php |
||
13 | abstract class AbstractString extends VOString |
||
14 | { |
||
15 | use Mixin; |
||
16 | |||
17 | /** |
||
18 | * @return array |
||
19 | */ |
||
20 | abstract public function toArray(); |
||
21 | |||
22 | /** |
||
23 | * @param array $array |
||
24 | * @throws \Exception |
||
25 | */ |
||
26 | public static function fromArray(array $array) |
||
33 | |||
34 | /** |
||
35 | * @param Yaml $yaml |
||
36 | * @return static |
||
37 | */ |
||
38 | public static function fromVOYaml(Yaml $yaml) |
||
42 | |||
43 | /** |
||
44 | * @param $yaml |
||
45 | * @return static |
||
46 | */ |
||
47 | public static function fromYaml($yaml) |
||
51 | |||
52 | /** |
||
53 | * @return Yaml |
||
54 | */ |
||
55 | public function toVOYaml() |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function toYaml() |
||
67 | |||
68 | /** |
||
69 | * @param Xml $xml |
||
70 | * @return static |
||
71 | */ |
||
72 | public function fromVOXml(Xml $xml) |
||
76 | |||
77 | /** |
||
78 | * @param $xml |
||
79 | * @return static |
||
80 | */ |
||
81 | public function fromXml($xml) |
||
85 | |||
86 | /** |
||
87 | * @return Xml |
||
88 | */ |
||
89 | public function toVOXml() |
||
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | public function toXml() |
||
101 | |||
102 | /** |
||
103 | * @param Json $json |
||
104 | * @return static |
||
105 | */ |
||
106 | public static function fromVOJson(Json $json) |
||
110 | |||
111 | /** |
||
112 | * @param string $json |
||
113 | * @return static |
||
114 | */ |
||
115 | public static function fromJson($json) |
||
119 | |||
120 | /** |
||
121 | * @return static |
||
122 | */ |
||
123 | public function toVOJson() |
||
127 | |||
128 | /** |
||
129 | * @return string |
||
130 | */ |
||
131 | public function toJson() |
||
135 | } |
||
136 |
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: