@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | /* Cannot be an alias because Output is not in OCA */ |
97 | 97 | $this->registerService(IOutput::class, fn (ContainerInterface $c): IOutput => new Output($c->get('webRoot'))); |
98 | 98 | |
99 | - $this->registerService(Folder::class, function () { |
|
99 | + $this->registerService(Folder::class, function() { |
|
100 | 100 | return $this->getServer()->getUserFolder(); |
101 | 101 | }); |
102 | 102 | |
103 | - $this->registerService(IAppData::class, function (ContainerInterface $c): IAppData { |
|
103 | + $this->registerService(IAppData::class, function(ContainerInterface $c): IAppData { |
|
104 | 104 | return $c->get(IAppDataFactory::class)->get($c->get('appName')); |
105 | 105 | }); |
106 | 106 | |
107 | - $this->registerService(IL10N::class, function (ContainerInterface $c) { |
|
107 | + $this->registerService(IL10N::class, function(ContainerInterface $c) { |
|
108 | 108 | return $this->getServer()->getL10N($c->get('appName')); |
109 | 109 | }); |
110 | 110 | |
111 | 111 | // Log wrappers |
112 | - $this->registerService(LoggerInterface::class, function (ContainerInterface $c) { |
|
112 | + $this->registerService(LoggerInterface::class, function(ContainerInterface $c) { |
|
113 | 113 | /* Cannot be an alias because it uses LoggerInterface so it would infinite loop */ |
114 | 114 | return new ScopedPsrLogger( |
115 | 115 | $c->get(PsrLoggerAdapter::class), |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ); |
118 | 118 | }); |
119 | 119 | |
120 | - $this->registerService(IServerContainer::class, function () { |
|
120 | + $this->registerService(IServerContainer::class, function() { |
|
121 | 121 | return $this->getServer(); |
122 | 122 | }); |
123 | 123 | /** @deprecated 32.0.0 */ |
@@ -129,28 +129,28 @@ discard block |
||
129 | 129 | $this->registerDeprecatedAlias(IAppContainer::class, ContainerInterface::class); |
130 | 130 | |
131 | 131 | // commonly used attributes |
132 | - $this->registerService('userId', function (ContainerInterface $c): ?string { |
|
132 | + $this->registerService('userId', function(ContainerInterface $c): ?string { |
|
133 | 133 | return $c->get(ISession::class)->get('user_id'); |
134 | 134 | }); |
135 | 135 | |
136 | - $this->registerService('webRoot', function (ContainerInterface $c): string { |
|
136 | + $this->registerService('webRoot', function(ContainerInterface $c): string { |
|
137 | 137 | return $c->get(IServerContainer::class)->getWebRoot(); |
138 | 138 | }); |
139 | 139 | |
140 | - $this->registerService('OC_Defaults', function (ContainerInterface $c): object { |
|
140 | + $this->registerService('OC_Defaults', function(ContainerInterface $c): object { |
|
141 | 141 | return $c->get(IServerContainer::class)->get('ThemingDefaults'); |
142 | 142 | }); |
143 | 143 | |
144 | 144 | /** @deprecated 32.0.0 */ |
145 | 145 | $this->registerDeprecatedAlias('Protocol', Http::class); |
146 | - $this->registerService(Http::class, function (ContainerInterface $c) { |
|
146 | + $this->registerService(Http::class, function(ContainerInterface $c) { |
|
147 | 147 | $protocol = $c->get(IRequest::class)->getHttpProtocol(); |
148 | 148 | return new Http($_SERVER, $protocol); |
149 | 149 | }); |
150 | 150 | |
151 | 151 | /** @deprecated 32.0.0 */ |
152 | 152 | $this->registerDeprecatedAlias('Dispatcher', Dispatcher::class); |
153 | - $this->registerService(Dispatcher::class, function (ContainerInterface $c) { |
|
153 | + $this->registerService(Dispatcher::class, function(ContainerInterface $c) { |
|
154 | 154 | return new Dispatcher( |
155 | 155 | $c->get(Http::class), |
156 | 156 | $c->get(MiddlewareDispatcher::class), |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | /** @deprecated 32.0.0 */ |
178 | 178 | $this->registerDeprecatedAlias('MiddlewareDispatcher', MiddlewareDispatcher::class); |
179 | - $this->registerService(MiddlewareDispatcher::class, function (ContainerInterface $c) { |
|
179 | + $this->registerService(MiddlewareDispatcher::class, function(ContainerInterface $c) { |
|
180 | 180 | $server = $this->getServer(); |
181 | 181 | |
182 | 182 | $dispatcher = new MiddlewareDispatcher(); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
293 | 293 | */ |
294 | 294 | public function registerCapability($serviceName) { |
295 | - $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
295 | + $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { |
|
296 | 296 | return $this->query($serviceName); |
297 | 297 | }); |
298 | 298 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return parent::query($name); |
348 | 348 | } elseif ($this->appName === 'core' && str_starts_with($name, 'OC\\Core\\')) { |
349 | 349 | return parent::query($name); |
350 | - } elseif (str_starts_with($name, \OC\AppFramework\App::buildAppNamespace($this->appName) . '\\')) { |
|
350 | + } elseif (str_starts_with($name, \OC\AppFramework\App::buildAppNamespace($this->appName).'\\')) { |
|
351 | 351 | return parent::query($name); |
352 | 352 | } elseif ( |
353 | 353 | str_starts_with($name, 'OC\\AppFramework\\Services\\') |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | return parent::query($name); |
358 | 358 | } |
359 | 359 | |
360 | - throw new QueryException('Could not resolve ' . $name . '!' |
|
360 | + throw new QueryException('Could not resolve '.$name.'!' |
|
361 | 361 | . ' Class can not be instantiated', 1); |
362 | 362 | } |
363 | 363 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (PHP_VERSION_ID >= 80400 && self::$useLazyObjects) { |
65 | 65 | /* For PHP>=8.4, use a lazy ghost to delay constructor and dependency resolving */ |
66 | 66 | /** @psalm-suppress UndefinedMethod */ |
67 | - return $class->newLazyGhost(function (object $object) use ($constructor): void { |
|
67 | + return $class->newLazyGhost(function(object $object) use ($constructor): void { |
|
68 | 68 | /** @psalm-suppress DirectConstructorCall For lazy ghosts we have to call the constructor directly */ |
69 | 69 | $object->__construct(...$this->buildClassConstructorParameters($constructor)); |
70 | 70 | }); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | private function buildClassConstructorParameters(\ReflectionMethod $constructor): array { |
77 | - return array_map(function (ReflectionParameter $parameter) { |
|
77 | + return array_map(function(ReflectionParameter $parameter) { |
|
78 | 78 | $parameterType = $parameter->getType(); |
79 | 79 | |
80 | 80 | $resolveName = $parameter->getName(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // don't lose the error we got while trying to query by type |
108 | - throw new QueryException($e->getMessage(), (int)$e->getCode(), $e); |
|
108 | + throw new QueryException($e->getMessage(), (int) $e->getCode(), $e); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | public function resolve($name) { |
118 | - $baseMsg = 'Could not resolve ' . $name . '!'; |
|
118 | + $baseMsg = 'Could not resolve '.$name.'!'; |
|
119 | 119 | try { |
120 | 120 | $class = new ReflectionClass($name); |
121 | 121 | if ($class->isInstantiable()) { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } catch (ReflectionException $e) { |
128 | 128 | // Class does not exist |
129 | - throw new QueryNotFoundException($baseMsg . ' ' . $e->getMessage()); |
|
129 | + throw new QueryNotFoundException($baseMsg.' '.$e->getMessage()); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | |
139 | 139 | if ($autoload) { |
140 | 140 | $object = $this->resolve($name); |
141 | - $this->registerService($name, function () use ($object) { |
|
141 | + $this->registerService($name, function() use ($object) { |
|
142 | 142 | return $object; |
143 | 143 | }); |
144 | 144 | return $object; |
145 | 145 | } |
146 | 146 | |
147 | - throw new QueryNotFoundException('Could not resolve ' . $name . '!'); |
|
147 | + throw new QueryNotFoundException('Could not resolve '.$name.'!'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param bool $shared |
166 | 166 | */ |
167 | 167 | public function registerService($name, Closure $closure, $shared = true) { |
168 | - $wrapped = function () use ($closure) { |
|
168 | + $wrapped = function() use ($closure) { |
|
169 | 169 | return $closure($this); |
170 | 170 | }; |
171 | 171 | $name = $this->sanitizeName($name); |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param string $target the target that should be resolved instead |
188 | 188 | */ |
189 | 189 | public function registerAlias($alias, $target): void { |
190 | - $this->registerService($alias, function (ContainerInterface $container) use ($target): mixed { |
|
190 | + $this->registerService($alias, function(ContainerInterface $container) use ($target): mixed { |
|
191 | 191 | return $container->get($target); |
192 | 192 | }, false); |
193 | 193 | } |
194 | 194 | |
195 | 195 | protected function registerDeprecatedAlias(string $alias, string $target): void { |
196 | - $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias): mixed { |
|
196 | + $this->registerService($alias, function(ContainerInterface $container) use ($target, $alias): mixed { |
|
197 | 197 | try { |
198 | 198 | $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.', [ |
|
199 | + $logger->debug('The requested alias "'.$alias.'" is deprecated. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', [ |
|
200 | 200 | 'app' => $this->appName ?? 'serverDI', |
201 | 201 | ]); |
202 | 202 | } catch (ContainerExceptionInterface $e) { |