Completed
Push — master ( 453450...6f0537 )
by
unknown
37:16
created
lib/private/DB/ResultAdapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	#[Override]
43
-	public function fetchAssociative(): array|false {
43
+	public function fetchAssociative(): array | false {
44 44
 		return $this->inner->fetchAssociative();
45 45
 	}
46 46
 
47 47
 	#[Override]
48
-	public function fetchNumeric(): array|false {
48
+	public function fetchNumeric(): array | false {
49 49
 		return $this->inner->fetchNumeric();
50 50
 	}
51 51
 
Please login to merge, or discard this patch.
lib/private/AppConfig.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 	private const LOCAL_CACHE_TTL = 3;
60 60
 
61 61
 	/** @var array<string, array<string, string>> ['app_id' => ['config_key' => 'config_value']] */
62
-	private array $fastCache = [];   // cache for normal config keys
62
+	private array $fastCache = []; // cache for normal config keys
63 63
 	/** @var array<string, array<string, string>> ['app_id' => ['config_key' => 'config_value']] */
64
-	private array $lazyCache = [];   // cache for lazy config keys
64
+	private array $lazyCache = []; // cache for lazy config keys
65 65
 	/** @var array<string, array<string, int>> ['app_id' => ['config_key' => bitflag]] */
66
-	private array $valueTypes = [];  // type for all config values
66
+	private array $valueTypes = []; // type for all config values
67 67
 	private bool $fastLoaded = false;
68 68
 	private bool $lazyLoaded = false;
69 69
 	/** @var array<string, array{entries: array<string, Entry>, aliases: array<string, string>, strictness: Strictness}> ['app_id' => ['strictness' => ConfigLexiconStrictness, 'entries' => ['config_key' => ConfigLexiconEntry[]]] */
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		public readonly CacheFactory $cacheFactory,
86 86
 	) {
87 87
 		if ($config->getSystemValueBool('cache_app_config', true) && $cacheFactory->isLocalCacheAvailable()) {
88
-			$cacheFactory->withServerVersionPrefix(function (ICacheFactory $factory) {
88
+			$cacheFactory->withServerVersionPrefix(function(ICacheFactory $factory) {
89 89
 				$this->localCache = $factory->createLocal();
90 90
 			});
91 91
 		}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$values = $this->formatAppValues($app, ($this->fastCache[$app] ?? []) + ($this->lazyCache[$app] ?? []));
243 243
 		$values = array_filter(
244 244
 			$values,
245
-			function (string $key) use ($prefix): bool {
245
+			function(string $key) use ($prefix): bool {
246 246
 				return str_starts_with($key, $prefix); // filter values based on $prefix
247 247
 			}, ARRAY_FILTER_USE_KEY
248 248
 		);
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		$values = [];
294 294
 		foreach (array_keys($cache) as $app) {
295 295
 			if (isset($cache[$app][$key])) {
296
-				$values[$app] = $this->convertTypedValue($cache[$app][$key], $typedAs ?? $this->getValueType((string)$app, $key, $lazy));
296
+				$values[$app] = $this->convertTypedValue($cache[$app][$key], $typedAs ?? $this->getValueType((string) $app, $key, $lazy));
297 297
 			}
298 298
 		}
299 299
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		int $default = 0,
389 389
 		bool $lazy = false,
390 390
 	): int {
391
-		return (int)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_INT);
391
+		return (int) $this->getTypedValue($app, $key, (string) $default, $lazy, self::VALUE_INT);
392 392
 	}
393 393
 
394 394
 	/**
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 * @see IAppConfig for explanation about lazy loading
407 407
 	 */
408 408
 	public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float {
409
-		return (float)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_FLOAT);
409
+		return (float) $this->getTypedValue($app, $key, (string) $default, $lazy, self::VALUE_FLOAT);
410 410
 	}
411 411
 
412 412
 	/**
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 		return $this->setTypedValue(
671 671
 			$app,
672 672
 			$key,
673
-			(string)$value,
673
+			(string) $value,
674 674
 			$lazy,
675 675
 			self::VALUE_INT | ($sensitive ? self::VALUE_SENSITIVE : 0)
676 676
 		);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		return $this->setTypedValue(
701 701
 			$app,
702 702
 			$key,
703
-			(string)$value,
703
+			(string) $value,
704 704
 			$lazy,
705 705
 			self::VALUE_FLOAT | ($sensitive ? self::VALUE_SENSITIVE : 0)
706 706
 		);
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
 		$origValue = $value;
807 807
 		if ($sensitive || ($this->hasKey($app, $key, $lazy) && $this->isSensitive($app, $key, $lazy))) {
808
-			$value = self::ENCRYPTION_PREFIX . $this->crypto->encrypt($value);
808
+			$value = self::ENCRYPTION_PREFIX.$this->crypto->encrypt($value);
809 809
 		}
810 810
 
811 811
 		if ($this->hasKey($app, $key, $lazy)) {
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 				} catch (AppConfigIncorrectTypeException) {
871 871
 					// can be ignored, this was just needed for a better exception message.
872 872
 				}
873
-				throw new AppConfigTypeConflictException('conflict between new type (' . $type . ') and old type (' . $currType . ')');
873
+				throw new AppConfigTypeConflictException('conflict between new type ('.$type.') and old type ('.$currType.')');
874 874
 			}
875 875
 
876 876
 			// we fix $type if the stored value, or the new value as it might be changed, is set as sensitive
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 		$value = $cache[$app][$key];
1005 1005
 		if ($sensitive) {
1006 1006
 			$type |= self::VALUE_SENSITIVE;
1007
-			$value = self::ENCRYPTION_PREFIX . $this->crypto->encrypt($value);
1007
+			$value = self::ENCRYPTION_PREFIX.$this->crypto->encrypt($value);
1008 1008
 		} else {
1009 1009
 			$value = $this->crypto->decrypt(substr($value, self::ENCRYPTION_PREFIX_LENGTH));
1010 1010
 		}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 			$typeString = $this->convertTypeToString($type);
1086 1086
 		} catch (AppConfigIncorrectTypeException $e) {
1087 1087
 			$this->logger->warning('type stored in database is not correct', ['exception' => $e, 'type' => $type]);
1088
-			$typeString = (string)$type;
1088
+			$typeString = (string) $type;
1089 1089
 		}
1090 1090
 
1091 1091
 		if (!isset($cache[$app][$key])) {
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 		try {
1134 1134
 			$lazy = false;
1135 1135
 			$this->matchAndApplyLexiconDefinition($app, $key, $lazy, lexiconEntry: $lexiconEntry);
1136
-		} catch (AppConfigTypeConflictException|AppConfigUnknownKeyException) {
1136
+		} catch (AppConfigTypeConflictException | AppConfigUnknownKeyException) {
1137 1137
 			// can be ignored
1138 1138
 		}
1139 1139
 
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 			'float' => IAppConfig::VALUE_FLOAT,
1169 1169
 			'boolean' => IAppConfig::VALUE_BOOL,
1170 1170
 			'array' => IAppConfig::VALUE_ARRAY,
1171
-			default => throw new AppConfigIncorrectTypeException('Unknown type ' . $type)
1171
+			default => throw new AppConfigIncorrectTypeException('Unknown type '.$type)
1172 1172
 		};
1173 1173
 	}
1174 1174
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 			IAppConfig::VALUE_FLOAT => 'float',
1190 1190
 			IAppConfig::VALUE_BOOL => 'boolean',
1191 1191
 			IAppConfig::VALUE_ARRAY => 'array',
1192
-			default => throw new AppConfigIncorrectTypeException('Unknown numeric type ' . $type)
1192
+			default => throw new AppConfigIncorrectTypeException('Unknown numeric type '.$type)
1193 1193
 		};
1194 1194
 	}
1195 1195
 
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 		}
1299 1299
 		if (strlen($app) > self::APP_MAX_LENGTH) {
1300 1300
 			throw new InvalidArgumentException(
1301
-				'Value (' . $app . ') for app is too long (' . self::APP_MAX_LENGTH . ')'
1301
+				'Value ('.$app.') for app is too long ('.self::APP_MAX_LENGTH.')'
1302 1302
 			);
1303 1303
 		}
1304 1304
 		if (strlen($configKey) > self::KEY_MAX_LENGTH) {
1305
-			throw new InvalidArgumentException('Value (' . $configKey . ') for key is too long (' . self::KEY_MAX_LENGTH . ')');
1305
+			throw new InvalidArgumentException('Value ('.$configKey.') for key is too long ('.self::KEY_MAX_LENGTH.')');
1306 1306
 		}
1307 1307
 		if ($valueType > -1) {
1308 1308
 			$valueType &= ~self::VALUE_SENSITIVE;
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 
1325 1325
 		// if lazy is null or true, we debug log
1326 1326
 		if ($lazy === true && $app !== null) {
1327
-			$exception = new \RuntimeException('The loading of lazy AppConfig values have been triggered by app "' . $app . '"');
1327
+			$exception = new \RuntimeException('The loading of lazy AppConfig values have been triggered by app "'.$app.'"');
1328 1328
 			$this->logger->debug($exception->getMessage(), ['exception' => $exception, 'app' => $app]);
1329 1329
 		}
1330 1330
 
@@ -1362,12 +1362,12 @@  discard block
 block discarded – undo
1362 1362
 		$rows = $result->fetchAll();
1363 1363
 		foreach ($rows as $row) {
1364 1364
 			// most of the time, 'lazy' is not in the select because its value is already known
1365
-			if ($lazy && ((int)$row['lazy']) === 1) {
1365
+			if ($lazy && ((int) $row['lazy']) === 1) {
1366 1366
 				$this->lazyCache[$row['appid']][$row['configkey']] = $row['configvalue'] ?? '';
1367 1367
 			} else {
1368 1368
 				$this->fastCache[$row['appid']][$row['configkey']] = $row['configvalue'] ?? '';
1369 1369
 			}
1370
-			$this->valueTypes[$row['appid']][$row['configkey']] = (int)($row['type'] ?? 0);
1370
+			$this->valueTypes[$row['appid']][$row['configkey']] = (int) ($row['type'] ?? 0);
1371 1371
 		}
1372 1372
 
1373 1373
 		$result->closeCursor();
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 		 * this solution would remove the loading of config values from disabled app
1435 1435
 		 * unless calling the method.
1436 1436
 		 */
1437
-		return $this->setTypedValue($app, $key, (string)$value, false, self::VALUE_MIXED);
1437
+		return $this->setTypedValue($app, $key, (string) $value, false, self::VALUE_MIXED);
1438 1438
 	}
1439 1439
 
1440 1440
 
@@ -1505,12 +1505,12 @@  discard block
 block discarded – undo
1505 1505
 	 *
1506 1506
 	 * @return string|int|float|bool|array
1507 1507
 	 */
1508
-	private function convertTypedValue(string $value, int $type): string|int|float|bool|array {
1508
+	private function convertTypedValue(string $value, int $type): string | int | float | bool | array {
1509 1509
 		switch ($type) {
1510 1510
 			case self::VALUE_INT:
1511
-				return (int)$value;
1511
+				return (int) $value;
1512 1512
 			case self::VALUE_FLOAT:
1513
-				return (float)$value;
1513
+				return (float) $value;
1514 1514
 			case self::VALUE_BOOL:
1515 1515
 				return in_array(strtolower($value), ['1', 'true', 'yes', 'on']);
1516 1516
 			case self::VALUE_ARRAY:
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
 		?bool &$lazy = null,
1685 1685
 		int &$type = self::VALUE_MIXED,
1686 1686
 		?string &$default = null,
1687
-		?Entry &$lexiconEntry = null,
1687
+		?Entry & $lexiconEntry = null,
1688 1688
 	): bool {
1689 1689
 		if (in_array($key,
1690 1690
 			[
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 		}
1702 1702
 
1703 1703
 		if (!array_key_exists($key, $configDetails['entries'])) {
1704
-			return $this->applyLexiconStrictness($configDetails['strictness'], $app . '/' . $key);
1704
+			return $this->applyLexiconStrictness($configDetails['strictness'], $app.'/'.$key);
1705 1705
 		}
1706 1706
 
1707 1707
 		// if lazy is NULL, we ignore all check on the type/lazyness/default from Lexicon
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 		if ($type === self::VALUE_MIXED) {
1718 1718
 			$type = $appConfigValueType; // we overwrite if value was requested as mixed
1719 1719
 		} elseif ($appConfigValueType !== $type) {
1720
-			throw new AppConfigTypeConflictException('The app config key ' . $app . '/' . $key . ' is typed incorrectly in relation to the config lexicon');
1720
+			throw new AppConfigTypeConflictException('The app config key '.$app.'/'.$key.' is typed incorrectly in relation to the config lexicon');
1721 1721
 		}
1722 1722
 
1723 1723
 		$lazy = $lexiconEntry->isLazy();
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 			$type |= self::VALUE_SENSITIVE;
1731 1731
 		}
1732 1732
 		if ($lexiconEntry->isDeprecated()) {
1733
-			$this->logger->notice('App config key ' . $app . '/' . $key . ' is set as deprecated.');
1733
+			$this->logger->notice('App config key '.$app.'/'.$key.' is set as deprecated.');
1734 1734
 		}
1735 1735
 
1736 1736
 		return true;
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 			return true;
1752 1752
 		}
1753 1753
 
1754
-		$line = 'The app config key ' . $configAppKey . ' is not defined in the config lexicon';
1754
+		$line = 'The app config key '.$configAppKey.' is not defined in the config lexicon';
1755 1755
 		switch ($strictness) {
1756 1756
 			case Strictness::IGNORE:
1757 1757
 				return true;
Please login to merge, or discard this patch.
lib/public/DB/IResult.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @since 33.0.0
57 57
 	 */
58
-	public function fetchAssociative(): array|false;
58
+	public function fetchAssociative(): array | false;
59 59
 
60 60
 	/**
61 61
 	 * Returns the next row of the result as a numeric array or FALSE if there are no more rows.
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @since 33.0.0
66 66
 	 */
67
-	public function fetchNumeric(): array|false;
67
+	public function fetchNumeric(): array | false;
68 68
 
69 69
 	/**
70 70
 	 * Returns the first value of the next row of the result or FALSE if there are no more rows.
Please login to merge, or discard this patch.
core/BackgroundJobs/MovePreviewJob.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$this->appData = $appDataFactory->get('preview');
54 54
 		$this->setTimeSensitivity(self::TIME_INSENSITIVE);
55 55
 		$this->setInterval(24 * 60 * 60);
56
-		$this->previewRootPath = 'appdata_' . $this->config->getSystemValueString('instanceid') . '/preview/';
56
+		$this->previewRootPath = 'appdata_'.$this->config->getSystemValueString('instanceid').'/preview/';
57 57
 	}
58 58
 
59 59
 	#[Override]
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 			$qb->select('path')
69 69
 				->from('filecache')
70 70
 				// Hierarchical preview folder structure
71
-				->where($qb->expr()->like('path', $qb->createNamedParameter($this->previewRootPath . '%/%/%/%/%/%/%/%/%')))
71
+				->where($qb->expr()->like('path', $qb->createNamedParameter($this->previewRootPath.'%/%/%/%/%/%/%/%/%')))
72 72
 				// Legacy flat preview folder structure
73
-				->orWhere($qb->expr()->like('path', $qb->createNamedParameter($this->previewRootPath . '%/%.%')))
73
+				->orWhere($qb->expr()->like('path', $qb->createNamedParameter($this->previewRootPath.'%/%.%')))
74 74
 				->hintShardKey('storage', $this->rootFolder->getMountPoint()->getNumericStorageId())
75 75
 				->setMaxResults(100);
76 76
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		while ($row = $result->fetchAssociative()) {
98 98
 			$pathSplit = explode('/', $row['path']);
99 99
 			assert(count($pathSplit) >= 2);
100
-			$fileId = (int)$pathSplit[count($pathSplit) - 2];
100
+			$fileId = (int) $pathSplit[count($pathSplit) - 2];
101 101
 			if (count($pathSplit) === 11) {
102 102
 				// Hierarchical structure
103 103
 				if (!in_array($fileId, $fileIds)) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param array<string|int, string[]> $previewFolders
127 127
 	 */
128 128
 	private function processPreviews(int $fileId, bool $flatPath): void {
129
-		$internalPath = $this->getInternalFolder((string)$fileId, $flatPath);
129
+		$internalPath = $this->getInternalFolder((string) $fileId, $flatPath);
130 130
 		$folder = $this->appData->getFolder($internalPath);
131 131
 
132 132
 		/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		$previewFiles = [];
136 136
 
137 137
 		foreach ($folder->getDirectoryListing() as $previewFile) {
138
-			$path = $fileId . '/' . $previewFile->getName();
138
+			$path = $fileId.'/'.$previewFile->getName();
139 139
 			/** @var SimpleFile $previewFile */
140 140
 			$preview = Preview::fromPath($path, $this->mimeTypeDetector);
141 141
 			$preview->setId($this->generator->nextId());
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 				$file = $previewFile['file'];
172 172
 				$preview->setStorageId($result[0]['storage']);
173 173
 				$preview->setEtag($result[0]['etag']);
174
-				$preview->setSourceMimeType($this->mimeTypeLoader->getMimetypeById((int)$result[0]['mimetype']));
174
+				$preview->setSourceMimeType($this->mimeTypeLoader->getMimetypeById((int) $result[0]['mimetype']));
175 175
 				try {
176 176
 					$preview = $this->previewMapper->insert($preview);
177 177
 				} catch (Exception) {
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 		if ($flatPath) {
219 219
 			return $name;
220 220
 		}
221
-		return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name;
221
+		return implode('/', str_split(substr(md5($name), 0, 7))).'/'.$name;
222 222
 	}
223 223
 
224 224
 	private function deleteFolder(string $path): void {
225 225
 		$current = $path;
226 226
 
227 227
 		while (true) {
228
-			$appDataPath = $this->previewRootPath . $current;
228
+			$appDataPath = $this->previewRootPath.$current;
229 229
 			$qb = $this->connection->getQueryBuilder();
230 230
 			$qb->delete('filecache')
231 231
 				->where($qb->expr()->eq('path_hash', $qb->createNamedParameter(md5($appDataPath))))
Please login to merge, or discard this patch.
core/Migrations/Version32000Date20250731062008.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
62 62
 		$duplicateCount = 0;
63 63
 
64 64
 		while ($category = $result->fetchAssociative()) {
65
-			$key = $category['uid'] . '|' . $category['type'] . '|' . $category['category'];
66
-			$categoryId = (int)$category['id'];
65
+			$key = $category['uid'].'|'.$category['type'].'|'.$category['category'];
66
+			$categoryId = (int) $category['id'];
67 67
 
68 68
 			if (!isset($seen[$key])) {
69 69
 				// First occurrence - keep this one
Please login to merge, or discard this patch.
core/Migrations/Version13000Date20170718121200.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1019,9 +1019,9 @@
 block discarded – undo
1019 1019
 
1020 1020
 		while ($row = $result->fetchAssociative()) {
1021 1021
 			preg_match('/(calendar)\/([A-z0-9-@_]+)\//', $row['propertypath'], $match);
1022
-			$insert->setParameter('propertypath', (string)$row['propertypath'])
1023
-				->setParameter('propertyname', (string)$row['propertyname'])
1024
-				->setParameter('propertyvalue', (string)$row['propertyvalue'])
1022
+			$insert->setParameter('propertypath', (string) $row['propertypath'])
1023
+				->setParameter('propertyname', (string) $row['propertyname'])
1024
+				->setParameter('propertyvalue', (string) $row['propertyvalue'])
1025 1025
 				->setParameter('userid', ($match[2] ?? ''));
1026 1026
 			$insert->executeStatement();
1027 1027
 		}
Please login to merge, or discard this patch.
core/Migrations/Version20000Date20201109081918.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,9 +79,9 @@
 block discarded – undo
79 79
 
80 80
 		$result = $query->executeQuery();
81 81
 		while ($row = $result->fetchAssociative()) {
82
-			$insert->setParameter('user', (string)$row['user'])
83
-				->setParameter('identifier', (string)$row['identifier'])
84
-				->setParameter('credentials', (string)$row['credentials']);
82
+			$insert->setParameter('user', (string) $row['user'])
83
+				->setParameter('identifier', (string) $row['identifier'])
84
+				->setParameter('credentials', (string) $row['credentials']);
85 85
 			$insert->executeStatement();
86 86
 		}
87 87
 		$result->closeCursor();
Please login to merge, or discard this patch.