Skip to content

Commit 33c009d

Browse files
refactor: Apply rector changes
Signed-off-by: GitHub <noreply@github.com>
1 parent 1091159 commit 33c009d

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use OCP\Files\InvalidContentException;
3030
use OCP\Files\InvalidPathException;
3131
use OCP\Files\LockNotAcquiredException;
32+
use OCP\Files\NotEnoughSpaceException;
3233
use OCP\Files\NotFoundException;
3334
use OCP\Files\NotPermittedException;
3435
use OCP\Files\Storage\IWriteStreamStorage;
@@ -621,7 +622,7 @@ private function convertToSabreException(\Exception $e) {
621622
if ($e instanceof NotFoundException) {
622623
throw new NotFound($this->l10n->t('File not found: %1$s', [$e->getMessage()]), 0, $e);
623624
}
624-
if ($e instanceof Files\NotEnoughSpaceException) {
625+
if ($e instanceof NotEnoughSpaceException) {
625626
throw new EntityTooLarge($this->l10n->t('Insufficient space'), 0, $e);
626627
}
627628

core/Controller/UpdateController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use OCP\AppFramework\Http\Attribute\OpenAPI;
2626
use OCP\AppFramework\Http\Attribute\PublicPage;
2727
use OCP\AppFramework\Http\DataResponse;
28+
use OCP\AppFramework\OCSController;
2829
use OCP\EventDispatcher\IEventDispatcher;
2930
use OCP\IConfig;
3031
use OCP\IEventSourceFactory;
@@ -34,7 +35,7 @@
3435
use Psr\Log\LoggerInterface;
3536

3637
#[OpenAPI(scope: OpenApi::SCOPE_IGNORE)]
37-
class UpdateController extends \OCP\AppFramework\OCSController {
38+
class UpdateController extends OCSController {
3839
public function __construct(
3940
string $appName,
4041
IRequest $request,

core/Service/CronService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private function runCli(string $appMode, ?array $jobClasses): void {
157157
}
158158

159159
// Try to log and unlock job in case of failure (eg. Allowed memory size exhausted)
160-
register_shutdown_function(function () {
160+
register_shutdown_function(function (): void {
161161
$error = error_get_last();
162162
if ($error === null) {
163163
return;

lib/private/App/AppManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use OCP\IURLGenerator;
3737
use OCP\IUser;
3838
use OCP\IUserSession;
39+
use OCP\L10N\IFactory;
3940
use OCP\Server;
4041
use OCP\ServerVersion;
4142
use OCP\Settings\IManager as ISettingsManager;
@@ -1240,7 +1241,7 @@ public function checkAppDependencies(string $appId, bool $ignoreMax = false): vo
12401241

12411242
$missing = $this->dependencyAnalyzer->analyze($info, $ignoreMax);
12421243
if ($missing !== []) {
1243-
$l = \OCP\Server::get(\OCP\L10N\IFactory::class)->get('core');
1244+
$l = Server::get(IFactory::class)->get('core');
12441245
$missingMsg = implode(PHP_EOL, $missing);
12451246
throw new \Exception(
12461247
$l->t('App "%1$s" cannot be installed because the following dependencies are not fulfilled: %2$s',

lib/private/Files/Cache/Cache.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
use OCP\Files\Cache\CacheEntryInsertedEvent;
2525
use OCP\Files\Cache\CacheEntryRemovedEvent;
2626
use OCP\Files\Cache\CacheEntryUpdatedEvent;
27-
use OCP\Files\Cache\CacheInsertEvent;
28-
use OCP\Files\Cache\CacheUpdateEvent;
2927
use OCP\Files\Cache\ICache;
3028
use OCP\Files\Cache\ICacheEntry;
3129
use OCP\Files\Config\IUserMountCache;
@@ -332,7 +330,7 @@ public function insert($file, array $data) {
332330
}
333331

334332
$event = new CacheEntryInsertedEvent($this->storage, $file, $fileId, $storageId);
335-
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
333+
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
336334
$this->eventDispatcher->dispatchTyped($event);
337335
return $fileId;
338336
}
@@ -436,7 +434,7 @@ public function update($id, array $data) {
436434
// path can still be null if the file doesn't exist
437435
if ($path !== null) {
438436
$event = new CacheEntryUpdatedEvent($this->storage, $path, $id, $this->getNumericStorageId());
439-
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
437+
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
440438
$this->eventDispatcher->dispatchTyped($event);
441439
}
442440
}
@@ -850,11 +848,11 @@ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
850848
$this->eventDispatcher->dispatchTyped(new CacheEntriesRemovedEvent([$event]));
851849

852850
$event = new CacheEntryInsertedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
853-
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
851+
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
854852
$this->eventDispatcher->dispatchTyped($event);
855853
} else {
856854
$event = new CacheEntryUpdatedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
857-
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
855+
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
858856
$this->eventDispatcher->dispatchTyped($event);
859857
}
860858
} else {

tests/lib/Files/Storage/Wrapper/QuotaTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use OC\Files\Storage\Local;
1414
use OC\Files\Storage\Wrapper\Quota;
1515
use OCP\Files;
16+
use OCP\Files\NotEnoughSpaceException;
1617
use OCP\ITempManager;
1718
use OCP\Server;
1819

@@ -246,14 +247,14 @@ public function testNoWriteStreamQuota(): void {
246247
$stream = fopen('php://temp', 'w+');
247248
fwrite($stream, 'foobar');
248249
rewind($stream);
249-
$this->expectException(Files\NotEnoughSpaceException::class);
250+
$this->expectException(NotEnoughSpaceException::class);
250251
$instance->writeStream('files/test.txt', $stream);
251252
}
252253

253254
public function testNoWriteStreamQuotaZero(): void {
254255
$instance = $this->getLimitedStorage(0.0);
255256
$stream = fopen('php://temp', 'w+');
256-
$this->expectException(Files\NotEnoughSpaceException::class);
257+
$this->expectException(NotEnoughSpaceException::class);
257258
$instance->writeStream('files/test.txt', $stream);
258259
}
259260
}

0 commit comments

Comments
 (0)