1 | <?php |
||
14 | abstract class Selectable |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | public $model; |
||
20 | |||
21 | /** |
||
22 | * @var Grid |
||
23 | */ |
||
24 | protected $grid; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $key = ''; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $multiple = false; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | protected $perPage = 10; |
||
40 | |||
41 | /** |
||
42 | * Selectable constructor. |
||
43 | * @param $key |
||
44 | * @param $multiple |
||
45 | */ |
||
46 | public function __construct($multiple = false, $key = '') |
||
53 | |||
54 | /** |
||
55 | * @return Grid |
||
56 | */ |
||
57 | abstract public function make(); |
||
58 | |||
59 | /** |
||
60 | * @param bool $multiple |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function render() |
||
84 | |||
85 | public function renderFormGrid($values) |
||
111 | |||
112 | protected function appendRemoveBtn($hide = true) |
||
125 | |||
126 | protected function initGrid() |
||
141 | |||
142 | /** |
||
143 | * @param string $method |
||
144 | * @param array $arguments |
||
145 | * |
||
146 | * @return mixed |
||
147 | */ |
||
148 | public function __call(string $method, array $arguments = []) |
||
152 | } |
||
153 |
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: