Skip to content

Commit b907b33

Browse files
Merge pull request #3369 from nextcloud/refactor/constructor-property-promotion
2 parents 66ba19c + 769eb50 commit b907b33

6 files changed

+12
-21
lines changed

lib/ACL/ACLStorageWrapper.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,8 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
176176

177177
/**
178178
* @inheritDoc
179-
* @param string $path
180-
* @param ?IStorage $storage
181179
*/
182-
public function getCache($path = '', $storage = null): ICache {
180+
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
183181
if (!$storage) {
184182
$storage = $this;
185183
}
@@ -202,10 +200,8 @@ public function getMetaData(string $path): ?array {
202200

203201
/**
204202
* @inheritDoc
205-
* @param string $path
206-
* @param ?IStorage $storage
207203
*/
208-
public function getScanner($path = '', $storage = null): IScanner {
204+
public function getScanner(string $path = '', ?IStorage $storage = null): IScanner {
209205
if (!$storage) {
210206
$storage = $this->storage;
211207
}

lib/Mount/GroupFolderStorage.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ public function getOwner(string $path): string|false {
4949

5050
/**
5151
* @inheritDoc
52-
* @param string $path
53-
* @param ?IStorage $storage
5452
*/
55-
public function getCache($path = '', $storage = null): ICache {
53+
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
5654
if ($this->cache) {
5755
return $this->cache;
5856
}

lib/Mount/RootPermissionsMask.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ public function getMetaData(string $path): ?array {
8888
return $data;
8989
}
9090

91-
/**
92-
* @param string $path
93-
* @param ?IStorage $storage
94-
*/
95-
public function getCache($path = '', $storage = null): ICache {
91+
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
9692
if (!$storage) {
9793
$storage = $this;
9894
}

lib/Trash/GroupTrashItem.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@
1414
use OCP\IUser;
1515

1616
class GroupTrashItem extends TrashItem {
17-
private string $internalOriginalLocation;
18-
1917
public function __construct(
2018
ITrashBackend $backend,
21-
string $originalLocation,
19+
private string $internalOriginalLocation,
2220
int $deletedTime,
2321
string $trashPath,
2422
FileInfo $fileInfo,
2523
IUser $user,
2624
private string $mountPoint,
2725
?IUser $deletedBy,
2826
) {
29-
$this->internalOriginalLocation = $originalLocation;
30-
parent::__construct($backend, $this->mountPoint . '/' . $originalLocation, $deletedTime, $trashPath, $fileInfo, $user, $deletedBy);
27+
parent::__construct($backend, $this->mountPoint . '/' . $this->internalOriginalLocation, $deletedTime, $trashPath, $fileInfo, $user, $deletedBy);
3128
}
3229

3330
public function getInternalOriginalLocation(): string {

rector.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* SPDX-License-Identifier: AGPL-3.0-or-later
77
*/
88
use Rector\Config\RectorConfig;
9+
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
910

1011
return RectorConfig::configure()
1112
->withPaths([
@@ -20,4 +21,7 @@
2021
typeDeclarations: true,
2122
)->withPhpSets(
2223
php81: true,
23-
);
24+
)->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
25+
'inline_public' => true,
26+
'rename_property' => true,
27+
]);

tests/Folder/FolderManagerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function testQuotaDefaultValue(): void {
454454
$this->config->expects($this->any())
455455
->method('getSystemValueInt')
456456
->with('groupfolders.quota.default', FileInfo::SPACE_UNLIMITED)
457-
->willReturnCallback(function () use (&$exponent) {
457+
->willReturnCallback(function () use (&$exponent): int {
458458
return 1024 ** ($exponent++);
459459
});
460460

0 commit comments

Comments
 (0)