Merge pull request #54282 from nextcloud/techdebt/noid/reduce-deprecation-spam

This commit is contained in:
John Molakvoæ 2025-08-08 10:04:22 +02:00 committed by GitHub
commit 3dac5b33ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -134,8 +134,7 @@ class App {
$eventLogger->start('app:controller:dispatcher', 'Initialize dispatcher and pre-middleware');
// initialize the dispatcher and run all the middleware before the controller
/** @var Dispatcher $dispatcher */
$dispatcher = $container['Dispatcher'];
$dispatcher = $container->get(Dispatcher::class);
$eventLogger->end('app:controller:dispatcher');

View file

@ -63,7 +63,7 @@ use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
class DIContainer extends SimpleContainer implements IAppContainer {
private string $appName;
protected string $appName;
private array $middleWares = [];
private ServerContainer $server;
@ -152,7 +152,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
$this->registerDeprecatedAlias('Dispatcher', Dispatcher::class);
$this->registerService(Dispatcher::class, function (ContainerInterface $c) {
return new Dispatcher(
$c->get('Protocol'),
$c->get(Http::class),
$c->get(MiddlewareDispatcher::class),
$c->get(IControllerMethodReflector::class),
$c->get(IRequest::class),

View file

@ -196,7 +196,9 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
$this->registerService($alias, function (ContainerInterface $container) use ($target, $alias): mixed {
try {
$logger = $container->get(LoggerInterface::class);
$logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']);
$logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', [
'app' => $this->appName ?? 'serverDI',
]);
} catch (ContainerExceptionInterface $e) {
// Could not get logger. Continue
}