Merge pull request #60102 from nextcloud/automated/noid/rector-changes

This commit is contained in:
Stephan Orbaugh 2026-05-28 12:31:17 +02:00 committed by GitHub
commit 4cad192bcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 12 deletions

View file

@ -29,6 +29,7 @@ use OCP\Files\IMimeTypeDetector;
use OCP\Files\InvalidContentException;
use OCP\Files\InvalidPathException;
use OCP\Files\LockNotAcquiredException;
use OCP\Files\NotEnoughSpaceException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\Storage\IWriteStreamStorage;
@ -621,7 +622,7 @@ class File extends Node implements IFile {
if ($e instanceof NotFoundException) {
throw new NotFound($this->l10n->t('File not found: %1$s', [$e->getMessage()]), 0, $e);
}
if ($e instanceof Files\NotEnoughSpaceException) {
if ($e instanceof NotEnoughSpaceException) {
throw new EntityTooLarge($this->l10n->t('Insufficient space'), 0, $e);
}

View file

@ -25,6 +25,7 @@ use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IEventSourceFactory;
@ -34,7 +35,7 @@ use OCP\Util;
use Psr\Log\LoggerInterface;
#[OpenAPI(scope: OpenApi::SCOPE_IGNORE)]
class UpdateController extends \OCP\AppFramework\OCSController {
class UpdateController extends OCSController {
public function __construct(
string $appName,
IRequest $request,

View file

@ -157,7 +157,7 @@ class CronService {
}
// Try to log and unlock job in case of failure (eg. Allowed memory size exhausted)
register_shutdown_function(function () {
register_shutdown_function(function (): void {
$error = error_get_last();
if ($error === null) {
return;

View file

@ -36,6 +36,7 @@ use OCP\INavigationManager;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\L10N\IFactory;
use OCP\Server;
use OCP\ServerVersion;
use OCP\Settings\IManager as ISettingsManager;
@ -1240,7 +1241,7 @@ class AppManager implements IAppManager {
$missing = $this->dependencyAnalyzer->analyze($info, $ignoreMax);
if ($missing !== []) {
$l = \OCP\Server::get(\OCP\L10N\IFactory::class)->get('core');
$l = Server::get(IFactory::class)->get('core');
$missingMsg = implode(PHP_EOL, $missing);
throw new \Exception(
$l->t('App "%1$s" cannot be installed because the following dependencies are not fulfilled: %2$s',

View file

@ -24,8 +24,6 @@ use OCP\Files\Cache\CacheEntriesRemovedEvent;
use OCP\Files\Cache\CacheEntryInsertedEvent;
use OCP\Files\Cache\CacheEntryRemovedEvent;
use OCP\Files\Cache\CacheEntryUpdatedEvent;
use OCP\Files\Cache\CacheInsertEvent;
use OCP\Files\Cache\CacheUpdateEvent;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Config\IUserMountCache;
@ -332,7 +330,7 @@ class Cache implements ICache {
}
$event = new CacheEntryInsertedEvent($this->storage, $file, $fileId, $storageId);
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
return $fileId;
}
@ -436,7 +434,7 @@ class Cache implements ICache {
// path can still be null if the file doesn't exist
if ($path !== null) {
$event = new CacheEntryUpdatedEvent($this->storage, $path, $id, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
}
}
@ -850,11 +848,11 @@ class Cache implements ICache {
$this->eventDispatcher->dispatchTyped(new CacheEntriesRemovedEvent([$event]));
$event = new CacheEntryInsertedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheInsertEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryInsertedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
} else {
$event = new CacheEntryUpdatedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId());
$this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event);
$this->eventDispatcher->dispatch(CacheEntryUpdatedEvent::class, $event);
$this->eventDispatcher->dispatchTyped($event);
}
} else {

View file

@ -13,6 +13,7 @@ use OC\Files\Cache\CacheEntry;
use OC\Files\Storage\Local;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files;
use OCP\Files\NotEnoughSpaceException;
use OCP\ITempManager;
use OCP\Server;
@ -246,14 +247,14 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$stream = fopen('php://temp', 'w+');
fwrite($stream, 'foobar');
rewind($stream);
$this->expectException(Files\NotEnoughSpaceException::class);
$this->expectException(NotEnoughSpaceException::class);
$instance->writeStream('files/test.txt', $stream);
}
public function testNoWriteStreamQuotaZero(): void {
$instance = $this->getLimitedStorage(0.0);
$stream = fopen('php://temp', 'w+');
$this->expectException(Files\NotEnoughSpaceException::class);
$this->expectException(NotEnoughSpaceException::class);
$instance->writeStream('files/test.txt', $stream);
}
}