1 | <?php |
||
21 | class Collection extends ArrayCollection |
||
22 | { |
||
23 | /** |
||
24 | * @var array|string[] |
||
25 | */ |
||
26 | private static $proxies; |
||
27 | |||
28 | /** |
||
29 | * @var BaseCollection |
||
30 | */ |
||
31 | private $inner; |
||
32 | |||
33 | /** |
||
34 | * Collection constructor. |
||
35 | * @param array|iterable $elements |
||
36 | */ |
||
37 | public function __construct($elements = []) |
||
45 | |||
46 | /** |
||
47 | * @return void |
||
48 | */ |
||
49 | private function exportProxies(): void |
||
59 | |||
60 | /** |
||
61 | * @param string $name |
||
62 | * @param array $arguments |
||
63 | * @return mixed |
||
64 | * @throws \BadMethodCallException |
||
65 | */ |
||
66 | public static function __callStatic(string $name, array $arguments = []) |
||
81 | |||
82 | /** |
||
83 | * Wrap the given value in a collection if applicable. |
||
84 | * |
||
85 | * @param mixed $value |
||
86 | * @return static |
||
87 | */ |
||
88 | public static function wrap($value): self |
||
101 | |||
102 | /** |
||
103 | * @param string $name |
||
104 | * @param array $arguments |
||
105 | * @return mixed |
||
106 | * @throws \BadMethodCallException |
||
107 | */ |
||
108 | public function __call(string $name, array $arguments = []) |
||
123 | |||
124 | /** |
||
125 | * @param string $key |
||
126 | * @return HigherOrderCollectionProxy |
||
127 | * @throws \InvalidArgumentException |
||
128 | */ |
||
129 | public function __get(string $key): HigherOrderCollectionProxy |
||
138 | } |
||
139 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: