| 1 | <?php |
||
| 16 | class ArrayField extends Field |
||
| 17 | { |
||
| 18 | protected $glue; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Render field value |
||
| 22 | * |
||
| 23 | * @param mixed $value |
||
| 24 | * @return string |
||
| 25 | * @throws Exception |
||
| 26 | */ |
||
| 27 | public function render($value) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Configure options resolver. |
||
| 41 | * |
||
| 42 | * @param OptionsResolver $resolver |
||
| 43 | * |
||
| 44 | * @return mixed |
||
| 45 | */ |
||
| 46 | public function configureOptions(OptionsResolver $resolver) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Set options values after options resolving. |
||
| 55 | * |
||
| 56 | * @param array $options |
||
| 57 | * |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function setOptions(array $options) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getType() |
||
| 72 | } |
||
| 73 |
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: