1
1
Fork 0

Cleanup namespaces

This commit is contained in:
Philipp Holzer 2021-10-27 20:16:34 +02:00
parent 7c38647573
commit d778af0b0e
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
3 changed files with 6 additions and 6 deletions

View file

@ -40,7 +40,7 @@ class Storage extends BaseAdmin
$storagebackend = Strings::escapeTags(trim($parameters['name'] ?? ''));
try {
/** @var \Friendica\Core\Storage\Capability\ICanConfigureStorage|false $newStorageConfig */
/** @var ICanConfigureStorage|false $newStorageConfig */
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
} catch (InvalidClassStorageException $storageException) {
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
@ -78,7 +78,6 @@ class Storage extends BaseAdmin
if (!empty($_POST['submit_save_set'])) {
try {
/** @var \Friendica\Core\Storage\Capability\ICanWriteToStorage $newstorage */
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
if (!DI::storageManager()->setBackend($newstorage)) {

View file

@ -31,6 +31,7 @@ use Friendica\Core\Session\Type\Memory;
use Friendica\Core\Storage\Exception\InvalidClassStorageException;
use Friendica\Core\Storage\Capability\ICanReadFromStorage;
use Friendica\Core\Storage\Capability\ICanWriteToStorage;
use Friendica\Core\Storage\Exception\StorageException;
use Friendica\Core\Storage\Repository\StorageManager;
use Friendica\Core\Storage\Type\Filesystem;
use Friendica\Core\Storage\Type\SystemResource;
@ -257,7 +258,7 @@ class StorageManagerTest extends DatabaseTest
$dice = (new Dice())
->addRules(include __DIR__ . '/../../../../../static/dependencies.config.php')
->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
->addRule(IHandleSessions::class, ['instanceOf' => Session\Type\Memory::class, 'shared' => true, 'call' => null]);
->addRule(IHandleSessions::class, ['instanceOf' => Memory::class, 'shared' => true, 'call' => null]);
DI::init($dice);
$storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
@ -308,7 +309,7 @@ class StorageManagerTest extends DatabaseTest
self::assertInstanceOf(SampleStorageBackend::class, $storageManager->getBackend());
self::expectException(\Friendica\Core\Storage\Exception\StorageException::class);
self::expectException(StorageException::class);
self::expectExceptionMessage('Cannot unregister Sample Storage, because it\'s currently active.');
$storageManager->unregister(SampleStorageBackend::class);

View file

@ -26,10 +26,10 @@ use Friendica\Test\MockedTest;
abstract class StorageConfigTest extends MockedTest
{
/** @return \Friendica\Core\Storage\Capability\ICanConfigureStorage */
/** @return ICanConfigureStorage */
abstract protected function getInstance();
abstract protected function assertOption(\Friendica\Core\Storage\Capability\ICanConfigureStorage $storage);
abstract protected function assertOption(ICanConfigureStorage $storage);
/**
* Test if the "getOption" is asserted