Skip to content

Commit 3dac5b3

Browse files
authored
Merge pull request #54282 from nextcloud/techdebt/noid/reduce-deprecation-spam
2 parents 5eeda5f + 2f18996 commit 3dac5b3

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/private/AppFramework/App.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ public static function main(string $controllerName, string $methodName, DIContai
134134
$eventLogger->start('app:controller:dispatcher', 'Initialize dispatcher and pre-middleware');
135135

136136
// initialize the dispatcher and run all the middleware before the controller
137-
/** @var Dispatcher $dispatcher */
138-
$dispatcher = $container['Dispatcher'];
137+
$dispatcher = $container->get(Dispatcher::class);
139138

140139
$eventLogger->end('app:controller:dispatcher');
141140

lib/private/AppFramework/DependencyInjection/DIContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
use Psr\Log\LoggerInterface;
6464

6565
class DIContainer extends SimpleContainer implements IAppContainer {
66-
private string $appName;
66+
protected string $appName;
6767
private array $middleWares = [];
6868
private ServerContainer $server;
6969

@@ -152,7 +152,7 @@ public function __construct(string $appName, array $urlParams = [], ?ServerConta
152152
$this->registerDeprecatedAlias('Dispatcher', Dispatcher::class);
153153
$this->registerService(Dispatcher::class, function (ContainerInterface $c) {
154154
return new Dispatcher(
155-
$c->get('Protocol'),
155+
$c->get(Http::class),
156156
$c->get(MiddlewareDispatcher::class),
157157
$c->get(IControllerMethodReflector::class),
158158
$c->get(IRequest::class),

lib/private/AppFramework/Utility/SimpleContainer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ protected function registerDeprecatedAlias(string $alias, string $target): void
196196
$this->registerService($alias, function (ContainerInterface $container) use ($target, $alias): mixed {
197197
try {
198198
$logger = $container->get(LoggerInterface::class);
199-
$logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']);
199+
$logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', [
200+
'app' => $this->appName ?? 'serverDI',
201+
]);
200202
} catch (ContainerExceptionInterface $e) {
201203
// Could not get logger. Continue
202204
}

0 commit comments

Comments
 (0)