Passed
Pull Request — master (#989)
by
unknown
06:44 queued 01:52
created
framework/Util/Helpers/TArrayHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
framework/Collections/TArraySubscription.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
223 223
 	 * with the TList (by {@see \Prado\Collections\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
 block discarded – undo
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 \Prado\Util\Helpers\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
 block discarded – undo
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');
Please login to merge, or discard this patch.
framework/Util/TSignalsDispatcher.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 		SIGALRM => self::FX_SIGNAL_ALARM, // Alarm signal.  Sent by pcntl_alarm when the time is over.
95 95
 		SIGHUP => self::FX_SIGNAL_HANG_UP, // Hangup signal. Sent to a process when its controlling terminal is closed.
96 96
 		SIGINT => self::FX_SIGNAL_INTERRUPT, // Interrupt signal. Typically generated by pressing Ctrl+C.
97
-		SIGQUIT => self::FX_SIGNAL_QUIT,  // Quit signal. Similar to SIGINT but produces a core dump when received by the process.
98
-		SIGTRAP => self::FX_SIGNAL_TRAP,  // Trace/breakpoint trap signal. Used by debuggers to catch trace and breakpoint conditions.
97
+		SIGQUIT => self::FX_SIGNAL_QUIT, // Quit signal. Similar to SIGINT but produces a core dump when received by the process.
98
+		SIGTRAP => self::FX_SIGNAL_TRAP, // Trace/breakpoint trap signal. Used by debuggers to catch trace and breakpoint conditions.
99 99
 		SIGABRT => self::FX_SIGNAL_ABORT, // Abort signal. Sent by the process itself to terminate due to a critical error condition.
100 100
 		SIGUSR1 => self::FX_SIGNAL_USER1, // User-defined signal 1.
101 101
 		SIGUSR2 => self::FX_SIGNAL_USER2, // User-defined signal 2.
102 102
 		SIGTERM => self::FX_SIGNAL_TERMINATE, // Termination signal. Typically used to request graceful termination of a process.
103 103
 		SIGCHLD => self::FX_SIGNAL_CHILD, // Child signal. Sent to a parent process when a child process terminates.
104
-		SIGCONT => self::FX_SIGNAL_CONTINUE,  // Continue signal. Sent to resume a process that has been stopped.
104
+		SIGCONT => self::FX_SIGNAL_CONTINUE, // Continue signal. Sent to resume a process that has been stopped.
105 105
 		SIGTSTP => self::FX_SIGNAL_TERMINAL_STOP, // Terminal stop signal. Sent by pressing Ctrl+Z to suspend the process.
106
-		SIGTTIN => self::FX_SIGNAL_BACKGROUND_READ,    // Background read signal. Sent to a process when it attempts to read from the terminal while in the background.
107
-		SIGTTOU => self::FX_SIGNAL_BACKGROUND_WRITE,   // Background write signal. Sent to a process when it attempts to write to the terminal while in the background.
106
+		SIGTTIN => self::FX_SIGNAL_BACKGROUND_READ, // Background read signal. Sent to a process when it attempts to read from the terminal while in the background.
107
+		SIGTTOU => self::FX_SIGNAL_BACKGROUND_WRITE, // Background write signal. Sent to a process when it attempts to write to the terminal while in the background.
108 108
 		SIGURG => self::FX_SIGNAL_URGENT, // Urgent condition signal. Indicates the arrival of out-of-band data on a socket.
109 109
 	];
110 110
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 			static::setAsyncSignals(true);
224 224
 		}
225 225
 
226
-		foreach(static::SIGNAL_MAP as $signal => $event) {
226
+		foreach (static::SIGNAL_MAP as $signal => $event) {
227 227
 			$handler = pcntl_signal_get_handler($signal);
228 228
 
229 229
 			if ($handler instanceof self) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 			$callable = is_callable($handler);
235 235
 			if ($callable) {
236
-				$handler = function ($sender, $param) use ($handler) {
236
+				$handler = function($sender, $param) use ($handler) {
237 237
 					return $handler($param->getSignal(), $param->getParameter());
238 238
 				};
239 239
 				self::$_priorHandlers[$signal][1] = $handler;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			return false;
278 278
 		}
279 279
 
280
-		foreach(self::$_priorHandlers as $signal => $originalCallback) {
280
+		foreach (self::$_priorHandlers as $signal => $originalCallback) {
281 281
 			pcntl_signal($signal, $originalCallback[0]);
282 282
 			$uninstallHandler = true;
283 283
 			switch ($signal) {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	{
326 326
 		if (isset(static::SIGNAL_MAP[$name])) {
327 327
 			$name = static::SIGNAL_MAP[$name];
328
-		} elseif(strncasecmp('pid:', $name, 4) === 0) {
328
+		} elseif (strncasecmp('pid:', $name, 4) === 0) {
329 329
 			if (is_numeric($pid = trim(substr($name, 4)))) {
330 330
 				return TProcessHelper::isRunning((int) $pid);
331 331
 			}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	{
348 348
 		if (isset(static::SIGNAL_MAP[$name])) {
349 349
 			$name = static::SIGNAL_MAP[$name];
350
-		} elseif(strncasecmp('pid:', $name, 4) === 0) {
350
+		} elseif (strncasecmp('pid:', $name, 4) === 0) {
351 351
 			if (is_numeric($pid = trim(substr($name, 4)))) {
352 352
 				$pid = (int) $pid;
353 353
 				return isset(self::$_pidHandlers[$pid]) && self::$_pidHandlers[$pid]->getCount() > 0;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	{
371 371
 		if (isset(static::SIGNAL_MAP[$name])) {
372 372
 			$name = static::SIGNAL_MAP[$name];
373
-		} elseif(strncasecmp('pid:', $name, 4) === 0) {
373
+		} elseif (strncasecmp('pid:', $name, 4) === 0) {
374 374
 			if (!is_numeric($pid = trim(substr($name, 4)))) {
375 375
 				throw new TInvalidOperationException('signalsdispatcher_bad_pid', $pid);
376 376
 			}
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 			$callback = self::$_priorHandlers[SIGALRM][1];
621 621
 		}
622 622
 
623
-		foreach($alarmTime !== null ? [$alarmTime] : array_keys(static::$_alarms) as $time) {
623
+		foreach ($alarmTime !== null ? [$alarmTime] : array_keys(static::$_alarms) as $time) {
624 624
 			if (($key = array_search($callback, static::$_alarms[$time] ?? [], true)) !== false) {
625 625
 				unset(static::$_alarms[$time][$key]);
626 626
 				if (is_array(static::$_alarms[$time] ?? false)) {
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			$nextTime = null;
662 662
 			$startTime = time();
663 663
 			$signalParam->setAlarmTime($startTime);
664
-			foreach(static::$_alarms as $alarmTime => $alarms) {
664
+			foreach (static::$_alarms as $alarmTime => $alarms) {
665 665
 				if ($alarmTime <= $startTime) {
666 666
 					array_map(fn ($alarm) => $alarm($this, $signalParam), static::$_alarms[$alarmTime]);
667 667
 					unset(static::$_alarms[$alarmTime]);
Please login to merge, or discard this patch.
framework/Util/Helpers/TProcessHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 		if (TProcessHelper::isSystemWindows()) {
163 163
 			if (is_string($command)) {
164
-				$command = '"' . $command . '"';  //Windows, better command support
164
+				$command = '"' . $command . '"'; //Windows, better command support
165 165
 			}
166 166
 		}
167 167
 		return $command;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			$output = shell_exec("wmic process where ProcessId={$pid} get priority");
232 232
 			preg_match('/^\s*Priority\s*\r?\n\s*(\d+)/m', $output, $matches);
233 233
 			if (isset($matches[1])) {
234
-				$priorityValues = [ // Map Windows Priority Numbers to Linux style Numbers
234
+				$priorityValues = [// Map Windows Priority Numbers to Linux style Numbers
235 235
 					TProcessWindowsPriority::Idle => static::WINDOWS_IDLE_PRIORITY,
236 236
 					TProcessWindowsPriority::BelowNormal => static::WINDOWS_BELOW_NORMAL_PRIORITY,
237 237
 					TProcessWindowsPriority::Normal => static::WINDOWS_NORMAL_PRIORITY,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			$pid = getmypid();
264 264
 		}
265 265
 		if (static::isSystemWindows()) {
266
-			$priorityValues = [ // The priority cap to windows text priority.
266
+			$priorityValues = [// The priority cap to windows text priority.
267 267
 				-15 => TProcessWindowsPriorityName::Realtime,
268 268
 				-10 => TProcessWindowsPriorityName::HighPriority,
269 269
 				-5 => TProcessWindowsPriorityName::AboveNormal,
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 				9 => TProcessWindowsPriorityName::BelowNormal,
272 272
 				PHP_INT_MAX => TProcessWindowsPriorityName::Idle,
273 273
 			];
274
-			foreach($priorityValues as $keyPriority => $priorityName) {
274
+			foreach ($priorityValues as $keyPriority => $priorityName) {
275 275
 				if ($priority <= $keyPriority) {
276 276
 					break;
277 277
 				}
Please login to merge, or discard this patch.
framework/Util/Behaviors/TCaptureForkLog.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			$logger->deleteLogs();
146 146
 			$logs = $logger->deleteProfileLogs();
147 147
 			$pid = getmypid();
148
-			foreach(array_keys($logs) as $key) { // Reset PROFILE_BEGIN to pid.
148
+			foreach (array_keys($logs) as $key) { // Reset PROFILE_BEGIN to pid.
149 149
 				$logs[$key][TLogger::LOG_LEVEL] &= ~TLogger::LOGGED;
150 150
 				$logs[$key][TLogger::LOG_PID] = $pid;
151 151
 			}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		if (!$this->_parentConnections) {
177 177
 			return;
178 178
 		}
179
-		if($pid && !isset($this->_parentConnections[$pid])) {
179
+		if ($pid && !isset($this->_parentConnections[$pid])) {
180 180
 			return;
181 181
 		}
182 182
 
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 		do {
188 188
 			$read = $connections;
189 189
 			if (stream_select($read, $write, $except, ($wait || count($childLogs)) ? 1 : 0, 0)) {
190
-				foreach($read as $pid => $socket) {
190
+				foreach ($read as $pid => $socket) {
191 191
 					$data = fread($socket, 8192);
192 192
 					do {
193 193
 						$iterate = false;
194
-						if($data !== false) {
194
+						if ($data !== false) {
195 195
 							if (array_key_exists($pid, $childLogs)) {
196 196
 								$childLogs[$pid][0] .= $data;
197 197
 							} else {
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 					} while ($iterate);
235 235
 				}
236 236
 			}
237
-		} while(count($childLogs) || $wait && ($pid && isset($connections[$pid]) || $pid === null && $connections));
237
+		} while (count($childLogs) || $wait && ($pid && isset($connections[$pid]) || $pid === null && $connections));
238 238
 
239 239
 		if (!$completeLogs) {
240 240
 			return;
241 241
 		}
242
-		foreach(array_merge(...$completeLogs) as $pid => $logs) {
242
+		foreach (array_merge(...$completeLogs) as $pid => $logs) {
243 243
 			Prado::getLogger()->mergeLogs(unserialize($logs));
244 244
 		}
245 245
 	}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			return;
258 258
 		}
259 259
 
260
-		if(!($logger instanceof TLogger)) {
260
+		if (!($logger instanceof TLogger)) {
261 261
 			$logger = Prado::getLogger();
262 262
 		}
263 263
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 					$data = substr($data, $count);
295 295
 				}
296 296
 			}
297
-		} while($count !== false && strlen($data) > 0);
297
+		} while ($count !== false && strlen($data) > 0);
298 298
 
299 299
 		if ($final) {
300 300
 			stream_socket_shutdown($this->_childConnection, STREAM_SHUT_RDWR);
Please login to merge, or discard this patch.
framework/Shell/Actions/TWebServerAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	 */
114 114
 	public function getAddress(): string
115 115
 	{
116
-		if(!$this->_address) {
116
+		if (!$this->_address) {
117 117
 			if ($this->getIpv6()) {
118 118
 				if ($this->getAll()) {
119 119
 					return '[::0]';
Please login to merge, or discard this patch.
framework/TComponent.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		foreach ($classes as $class) {
515 515
 			if (isset(self::$_um[$class])) {
516 516
 				foreach (self::$_um[$class] as $name => $behavior) {
517
-					if(is_numeric($name)) {
517
+					if (is_numeric($name)) {
518 518
 						continue;
519 519
 					}
520 520
 					if (!array_key_exists($name, $classBehaviors)) {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 		}
790 790
 
791 791
 		if (isset(self::$_um[$lclass = strtolower(static::class)])) {
792
-			foreach(self::$_um[$lclass] as $pbehavior) {
792
+			foreach (self::$_um[$lclass] as $pbehavior) {
793 793
 				$class = $behavior = $pbehavior->getBehavior();
794 794
 				if (is_array($behavior)) {
795 795
 					$class = $behavior['class'];
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		$name = strtolower($name);
1455 1455
 		$responses = [];
1456 1456
 
1457
-		if($param instanceof IEventParameter) {
1457
+		if ($param instanceof IEventParameter) {
1458 1458
 			$param->setEventName($name);
1459 1459
 		}
1460 1460
 
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
 		$behaviorObject->setName($name);
1819 1819
 		$isClassBehavior = $behaviorObject instanceof IClassBehavior;
1820 1820
 		unset(self::$_um[$class][$name]);
1821
-		if(empty(self::$_um[$class])) {
1821
+		if (empty(self::$_um[$class])) {
1822 1822
 			unset(self::$_um[$class]);
1823 1823
 		}
1824 1824
 		$results = $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param);
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 			return $this->_m[$behaviorname];
1841 1841
 		}
1842 1842
 		if ((class_exists($behaviorname, false) || interface_exists($behaviorname, false)) && $this->_m) {
1843
-			foreach($this->_m->toArray() as $behavior) {
1843
+			foreach ($this->_m->toArray() as $behavior) {
1844 1844
 				if ($behavior instanceof $behaviorname) {
1845 1845
 					return $behavior;
1846 1846
 				}
Please login to merge, or discard this patch.