1 | <?php |
||
11 | final class InformationCollectionStruct extends ValueObject |
||
12 | { |
||
13 | /** |
||
14 | * The language code of the version. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $languageCode; |
||
19 | |||
20 | /** |
||
21 | * @var \eZ\Publish\API\Repository\Values\Content\Content |
||
22 | */ |
||
23 | protected $content; |
||
24 | |||
25 | /** |
||
26 | * @var \eZ\Publish\API\Repository\Values\ContentType\ContentType |
||
27 | */ |
||
28 | protected $contentType; |
||
29 | |||
30 | /** |
||
31 | * @var \EzSystems\RepositoryForms\Data\Content\FieldData[] |
||
32 | */ |
||
33 | protected $fields; |
||
34 | |||
35 | public function __construct(Content $content, ContentType $contentType, array $fields, string $languageCode) |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getLanguageCode(): string |
||
53 | |||
54 | /** |
||
55 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
56 | */ |
||
57 | public function getContent(): Content |
||
61 | |||
62 | /** |
||
63 | * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType |
||
64 | */ |
||
65 | public function getContentType(): ContentType |
||
69 | |||
70 | /** |
||
71 | * @return \EzSystems\RepositoryForms\Data\Content\FieldData[] |
||
72 | */ |
||
73 | public function getFieldsData(): array |
||
77 | |||
78 | /** |
||
79 | * @return \EzSystems\RepositoryForms\Data\Content\FieldData[] |
||
80 | */ |
||
81 | public function getCollectedFields(): array |
||
85 | |||
86 | protected function addFieldData(FieldData $fieldData) |
||
90 | } |
||
91 |
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: