@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param ?bool $autoSubscribe Default null for autoSubscribing when there is a |
42 | 42 | * key or item. |
43 | 43 | */ |
44 | - public function __construct(?ArrayAccess $collection = null, mixed $key = null, mixed $item = null, null|int|float $priority = null, null|bool|int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
44 | + public function __construct(?ArrayAccess $collection = null, mixed $key = null, mixed $item = null, null | int | float $priority = null, null | bool | int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
45 | 45 | { |
46 | 46 | parent::__construct($collection, $key, $item, $priority, $isAssociative, $autoSubscribe); |
47 | 47 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * The ArrayAccess collection for getting the array without pass by reference. |
51 | 51 | * @param bool $weak Return the collection in as a WeakReference. |
52 | 52 | */ |
53 | - public function getCollection(bool $weak = false): null|ArrayAccess|WeakReference |
|
53 | + public function getCollection(bool $weak = false): null | ArrayAccess | WeakReference |
|
54 | 54 | { |
55 | 55 | return $this->getArray($weak); |
56 | 56 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function weakCustomAdd(object $object) |
123 | 123 | { |
124 | - if($object instanceof TEventHandler) { |
|
124 | + if ($object instanceof TEventHandler) { |
|
125 | 125 | $object = $object->getHandlerObject(); |
126 | 126 | $this->_eventHandlerCount++; |
127 | 127 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function weakCustomRemove(object $object) |
139 | 139 | { |
140 | - if($object instanceof TEventHandler) { |
|
140 | + if ($object instanceof TEventHandler) { |
|
141 | 141 | $object = $object->getHandlerObject(); |
142 | 142 | $this->_eventHandlerCount--; |
143 | 143 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $item[$key] = $element; |
162 | 162 | } |
163 | 163 | } elseif (is_object($item)) { |
164 | - if($item instanceof WeakReference) { |
|
164 | + if ($item instanceof WeakReference) { |
|
165 | 165 | $item = $item->get(); |
166 | 166 | } elseif (($item instanceof TEventHandler) && !$item->hasHandler()) { |
167 | 167 | $item = null; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if ($isEventHandler = ($object instanceof TEventHandler)) { |
208 | 208 | $object = $object->getHandlerObject(true); |
209 | 209 | } |
210 | - if(($object instanceof WeakReference) && $object->get() === null) { |
|
210 | + if (($object instanceof WeakReference) && $object->get() === null) { |
|
211 | 211 | $this->_c--; |
212 | 212 | if ($i === $this->_c) { |
213 | 213 | array_pop($this->_d); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function setDiscardInvalid($value): void |
249 | 249 | { |
250 | - if($value === $this->_discardInvalid) { |
|
250 | + if ($value === $this->_discardInvalid) { |
|
251 | 251 | return; |
252 | 252 | } |
253 | 253 | if ($this->_discardInvalid !== null && !Prado::isCallingSelf()) { |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $object = $object->get(); |
267 | 267 | } |
268 | 268 | if ($object === null) { |
269 | - $this->_c--; //on read only, parent::removeAt won't remove for scrub. |
|
269 | + $this->_c--; //on read only, parent::removeAt won't remove for scrub. |
|
270 | 270 | if ($i === $this->_c) { |
271 | 271 | array_pop($this->_d); |
272 | 272 | } else { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $this->filterItemForInput($item); |
446 | 446 | if (($index = parent::indexOf($item)) === -1 && $this->_eventHandlerCount) { |
447 | 447 | $index = false; |
448 | - foreach($this->_d as $index => $dItem) { |
|
448 | + foreach ($this->_d as $index => $dItem) { |
|
449 | 449 | if (($dItem instanceof TEventHandler) && $dItem->isSameHandler($item, true)) { |
450 | 450 | break; |
451 | 451 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @var null|int|string The key that the item is added to the array. |
80 | 80 | */ |
81 | - private null|int|string $_key = null; |
|
81 | + private null | int | string $_key = null; |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @var mixed The item subscribing to the array. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @var null|bool|int Is the array an associative array. False for a "list" style array. |
96 | 96 | * null for discovery of the style of array on subscribe. default true. |
97 | 97 | */ |
98 | - protected null|bool|int $_isAssoc = true; |
|
98 | + protected null | bool | int $_isAssoc = true; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @var bool Is the item inserted into the collection. |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * the item. Default 1 for true except for TList. |
136 | 136 | * @param bool $autoSubscribe Should the |
137 | 137 | */ |
138 | - public function __construct(mixed &$array = null, mixed $key = null, mixed $item = null, null|int|float $priority = null, null|bool|int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
138 | + public function __construct(mixed &$array = null, mixed $key = null, mixed $item = null, null | int | float $priority = null, null | bool | int $isAssociative = 1, ?bool $autoSubscribe = null) |
|
139 | 139 | { |
140 | 140 | $this->setArray($array); |
141 | 141 | $this->setKey($key); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param bool $weak |
178 | 178 | * @return array|ArrayAccess The subscribed array-collection, passed by reference. |
179 | 179 | */ |
180 | - public function &getArray(bool $weak = false): array|ArrayAccess|WeakReference|null |
|
180 | + public function &getArray(bool $weak = false): array | ArrayAccess | WeakReference | null |
|
181 | 181 | { |
182 | 182 | if ($this->_array instanceof WeakReference) { |
183 | 183 | if ($weak) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @throws TInvalidOperationException If the item is already subscribed. |
203 | 203 | * @return static The current object. |
204 | 204 | */ |
205 | - public function setArray(null|array|ArrayAccess &$value): static |
|
205 | + public function setArray(null | array | ArrayAccess & $value): static |
|
206 | 206 | { |
207 | 207 | if ($this->_isSubscribed) { |
208 | 208 | throw new TInvalidOperationException('arraysubscription_no_change', 'Array'); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * with the TList (by {@see TList::indexOf()}) or array (by array_search). |
224 | 224 | * @return null|int|string The key for the item subscription to the array. |
225 | 225 | */ |
226 | - public function getKey(): null|int|string |
|
226 | + public function getKey(): null | int | string |
|
227 | 227 | { |
228 | 228 | $collection = &$this->getArray(); |
229 | 229 | if ($this->_isSubscribed && $this->_key === null) { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * as a list from (0, ..., count() - 1). if null, where needed, the "list"ness |
323 | 323 | * of the array will be determined by {@see TArrayHelper::array_is_list()}. |
324 | 324 | */ |
325 | - public function getIsAssociative(): null|bool|int |
|
325 | + public function getIsAssociative(): null | bool | int |
|
326 | 326 | { |
327 | 327 | return $this->_isAssoc; |
328 | 328 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @throws TInvalidOperationException If the item is already subscribed. |
335 | 335 | * @return static The current object. |
336 | 336 | */ |
337 | - public function setIsAssociative(null|bool|int $value = null): static |
|
337 | + public function setIsAssociative(null | bool | int $value = null): static |
|
338 | 338 | { |
339 | 339 | if ($this->_isSubscribed) { |
340 | 340 | throw new TInvalidOperationException('arraysubscription_no_change', 'Key'); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function weakCustomAdd(object $object) |
138 | 138 | { |
139 | - if($object instanceof TEventHandler) { |
|
139 | + if ($object instanceof TEventHandler) { |
|
140 | 140 | $object = $object->getHandlerObject(); |
141 | 141 | if (!$object) { |
142 | 142 | return; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function weakCustomRemove(object $object) |
157 | 157 | { |
158 | - if($object instanceof TEventHandler) { |
|
158 | + if ($object instanceof TEventHandler) { |
|
159 | 159 | $object = $object->getHandlerObject(); |
160 | 160 | if (!$object) { |
161 | 161 | return; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $handler = null; |
196 | 196 | } |
197 | 197 | } elseif (is_object($handler)) { |
198 | - if($handler instanceof WeakReference) { |
|
198 | + if ($handler instanceof WeakReference) { |
|
199 | 199 | $handler = $handler->get(); |
200 | 200 | } elseif (($handler instanceof TEventHandler) && !$handler->hasHandler()) { |
201 | 201 | $handler = null; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function setDiscardInvalid($value): void |
296 | 296 | { |
297 | - if($value === $this->_discardInvalid) { |
|
297 | + if ($value === $this->_discardInvalid) { |
|
298 | 298 | return; |
299 | 299 | } |
300 | 300 | if ($this->_discardInvalid !== null && !Prado::isCallingSelf()) { |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $obj = $obj->getHandlerObject(true); |
314 | 314 | } |
315 | 315 | if ($obj instanceof WeakReference) { |
316 | - if($obj = $obj->get()) { |
|
316 | + if ($obj = $obj->get()) { |
|
317 | 317 | $this->weakAdd($obj); |
318 | 318 | } else { |
319 | 319 | parent::removeAtIndexInPriority($i, $priority); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | throw new TInvalidDataValueException('weakcallablecollection_callable_required'); |
525 | 525 | } |
526 | 526 | $return = null; |
527 | - foreach($items as $item) { |
|
527 | + foreach ($items as $item) { |
|
528 | 528 | $itemPriority = null; |
529 | 529 | if (($isPriorityItem = ($item instanceof IPriorityItem)) && ($priority === null || !is_numeric($priority))) { |
530 | 530 | $itemPriority = $priority = $item->getPriority(); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $result = parent::insertAtIndexInPriority($item, $index, $priority, $preserveCache); |
541 | 541 | if ($return === null) { |
542 | 542 | $return = $result; |
543 | - } elseif(!is_array($return)) { |
|
543 | + } elseif (!is_array($return)) { |
|
544 | 544 | $return = [$return, $result]; |
545 | 545 | } else { |
546 | 546 | $return[] = $result; |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | continue; |
714 | 714 | } elseif ($p == $priority) { |
715 | 715 | $index = false; |
716 | - foreach($this->_d[$p] as $index => $pItem) { |
|
716 | + foreach ($this->_d[$p] as $index => $pItem) { |
|
717 | 717 | if ($item === $pItem || ($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
718 | 718 | break; |
719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $this->flattenPriorities(); |
732 | 732 | |
733 | 733 | if (($index = array_search($item, $this->_fd, true)) === false && $this->_eventHandlerCount) { |
734 | - foreach($this->_fd as $index => $pItem) { |
|
734 | + foreach ($this->_fd as $index => $pItem) { |
|
735 | 735 | if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
736 | 736 | break; |
737 | 737 | } |
@@ -783,8 +783,8 @@ discard block |
||
783 | 783 | $absindex = 0; |
784 | 784 | foreach (array_keys($this->_d) as $priority) { |
785 | 785 | $index = false; |
786 | - foreach($this->_d[$priority] as $index => $pItem) { |
|
787 | - if(($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
786 | + foreach ($this->_d[$priority] as $index => $pItem) { |
|
787 | + if (($pItem instanceof TEventHandler) && $pItem->isSameHandler($item, true)) { |
|
788 | 788 | break; |
789 | 789 | } |
790 | 790 | $index = false; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param ?bool $autoSubscribe |
50 | 50 | * @param mixed $index |
51 | 51 | */ |
52 | - public function __construct(?TComponent $component = null, mixed $event = null, mixed $handler = null, null|int|float $priority = null, ?bool $autoSubscribe = null, mixed $index = null) |
|
52 | + public function __construct(?TComponent $component = null, mixed $event = null, mixed $handler = null, null | int | float $priority = null, ?bool $autoSubscribe = null, mixed $index = null) |
|
53 | 53 | { |
54 | 54 | if ($component) { |
55 | 55 | $this->setComponent($component); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param bool $weak |
66 | 66 | * @return null|array|ArrayAccess|WeakReference The Event Handler from the component. |
67 | 67 | */ |
68 | - public function &getArray(bool $weak = false): array|ArrayAccess|WeakReference|null |
|
68 | + public function &getArray(bool $weak = false): array | ArrayAccess | WeakReference | null |
|
69 | 69 | { |
70 | 70 | if ($handlers = parent::getArray($weak)) { |
71 | 71 | return $handlers; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param null|array|ArrayAccess $value |
101 | 101 | * @throws TInvalidOperationException This property cannot be set directly. |
102 | 102 | */ |
103 | - public function setArray(null|array|ArrayAccess &$value): static |
|
103 | + public function setArray(null | array | ArrayAccess & $value): static |
|
104 | 104 | { |
105 | 105 | if ($value !== null) { |
106 | 106 | throw new TInvalidOperationException('eventsubscription_no_setarray'); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @return bool is the array a list. |
29 | 29 | * @link https://www.php.net/manual/en/function.array-is-list.php |
30 | 30 | */ |
31 | - public static function array_is_list(array|Traversable $array): bool |
|
31 | + public static function array_is_list(array | Traversable $array): bool |
|
32 | 32 | { |
33 | 33 | if (function_exists('array_is_list') && !($array instanceof Traversable)) { |
34 | 34 | return array_is_list($array); |