Skip to content

Commit 34cbd3e

Browse files
wouterjnicolas-grekas
authored andcommitted
[Components] Convert to native return types
1 parent d61a8ff commit 34cbd3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+118
-409
lines changed

Bundle/Bundle.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,19 @@ abstract class Bundle implements BundleInterface
3434
*/
3535
protected $container;
3636

37-
/**
38-
* @return void
39-
*/
40-
public function boot()
37+
public function boot(): void
4138
{
4239
}
4340

44-
/**
45-
* @return void
46-
*/
47-
public function shutdown()
41+
public function shutdown(): void
4842
{
4943
}
5044

5145
/**
5246
* This method can be overridden to register compilation passes,
5347
* other extensions, ...
54-
*
55-
* @return void
5648
*/
57-
public function build(ContainerBuilder $container)
49+
public function build(ContainerBuilder $container): void
5850
{
5951
}
6052

@@ -121,10 +113,7 @@ final public function getName(): string
121113
return $this->name;
122114
}
123115

124-
/**
125-
* @return void
126-
*/
127-
public function registerCommands(Application $application)
116+
public function registerCommands(Application $application): void
128117
{
129118
}
130119

Bundle/BundleInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,5 @@ public function getNamespace(): string;
6767
*/
6868
public function getPath(): string;
6969

70-
/**
71-
* @return void
72-
*/
73-
public function setContainer(?ContainerInterface $container);
70+
public function setContainer(?ContainerInterface $container): void;
7471
}

CacheClearer/CacheClearerInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ interface CacheClearerInterface
2020
{
2121
/**
2222
* Clears any caches necessary.
23-
*
24-
* @return void
2523
*/
26-
public function clear(string $cacheDir);
24+
public function clear(string $cacheDir): void;
2725
}

CacheClearer/Psr6CacheClearer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ public function clearPool(string $name): bool
5757
return $this->pools[$name]->clear();
5858
}
5959

60-
/**
61-
* @return void
62-
*/
63-
public function clear(string $cacheDir)
60+
public function clear(string $cacheDir): void
6461
{
6562
foreach ($this->pools as $pool) {
6663
$pool->clear();

CacheWarmer/CacheWarmer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
*/
1919
abstract class CacheWarmer implements CacheWarmerInterface
2020
{
21-
/**
22-
* @return void
23-
*/
24-
protected function writeCacheFile(string $file, $content)
21+
protected function writeCacheFile(string $file, $content): void
2522
{
2623
$tmpFile = @tempnam(\dirname($file), basename($file));
2724
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {

CacheWarmer/CacheWarmerInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ interface CacheWarmerInterface extends WarmableInterface
2525
*
2626
* A warmer should return true if the cache can be
2727
* generated incrementally and on-demand.
28-
*
29-
* @return bool
3028
*/
31-
public function isOptional();
29+
public function isOptional(): bool;
3230
}

CacheWarmer/WarmableInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ interface WarmableInterface
2323
*
2424
* @return string[] A list of classes or files to preload on PHP 7.4+
2525
*/
26-
public function warmUp(string $cacheDir);
26+
public function warmUp(string $cacheDir): array;
2727
}

DataCollector/DataCollector.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function cloneVar(mixed $var): Data
5858
/**
5959
* @return callable[] The casters to add to the cloner
6060
*/
61-
protected function getCasters()
61+
protected function getCasters(): array
6262
{
6363
$casters = [
6464
'*' => function ($v, array $a, Stub $s, $isNested) {
@@ -82,10 +82,7 @@ public function __sleep(): array
8282
return ['data'];
8383
}
8484

85-
/**
86-
* @return void
87-
*/
88-
public function __wakeup()
85+
public function __wakeup(): void
8986
{
9087
}
9188

DataCollector/DataCollectorInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ interface DataCollectorInterface extends ResetInterface
2424
{
2525
/**
2626
* Collects data for the given Request and Response.
27-
*
28-
* @return void
2927
*/
30-
public function collect(Request $request, Response $response, \Throwable $exception = null);
28+
public function collect(Request $request, Response $response, \Throwable $exception = null): void;
3129

3230
/**
3331
* Returns the name of the collector.
34-
*
35-
* @return string
3632
*/
37-
public function getName();
33+
public function getName(): string;
3834
}

DataCollector/LateDataCollectorInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ interface LateDataCollectorInterface
2020
{
2121
/**
2222
* Collects data as late as possible.
23-
*
24-
* @return void
2523
*/
26-
public function lateCollect();
24+
public function lateCollect(): void;
2725
}

DataCollector/RequestDataCollector.php

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -195,74 +195,47 @@ public function getPathInfo(): string
195195
return $this->data['path_info'];
196196
}
197197

198-
/**
199-
* @return ParameterBag
200-
*/
201-
public function getRequestRequest()
198+
public function getRequestRequest(): ParameterBag
202199
{
203200
return new ParameterBag($this->data['request_request']->getValue());
204201
}
205202

206-
/**
207-
* @return ParameterBag
208-
*/
209-
public function getRequestQuery()
203+
public function getRequestQuery(): ParameterBag
210204
{
211205
return new ParameterBag($this->data['request_query']->getValue());
212206
}
213207

214-
/**
215-
* @return ParameterBag
216-
*/
217-
public function getRequestFiles()
208+
public function getRequestFiles(): ParameterBag
218209
{
219210
return new ParameterBag($this->data['request_files']->getValue());
220211
}
221212

222-
/**
223-
* @return ParameterBag
224-
*/
225-
public function getRequestHeaders()
213+
public function getRequestHeaders(): ParameterBag
226214
{
227215
return new ParameterBag($this->data['request_headers']->getValue());
228216
}
229217

230-
/**
231-
* @return ParameterBag
232-
*/
233-
public function getRequestServer(bool $raw = false)
218+
public function getRequestServer(bool $raw = false): ParameterBag
234219
{
235220
return new ParameterBag($this->data['request_server']->getValue($raw));
236221
}
237222

238-
/**
239-
* @return ParameterBag
240-
*/
241-
public function getRequestCookies(bool $raw = false)
223+
public function getRequestCookies(bool $raw = false): ParameterBag
242224
{
243225
return new ParameterBag($this->data['request_cookies']->getValue($raw));
244226
}
245227

246-
/**
247-
* @return ParameterBag
248-
*/
249-
public function getRequestAttributes()
228+
public function getRequestAttributes(): ParameterBag
250229
{
251230
return new ParameterBag($this->data['request_attributes']->getValue());
252231
}
253232

254-
/**
255-
* @return ParameterBag
256-
*/
257-
public function getResponseHeaders()
233+
public function getResponseHeaders(): ParameterBag
258234
{
259235
return new ParameterBag($this->data['response_headers']->getValue());
260236
}
261237

262-
/**
263-
* @return ParameterBag
264-
*/
265-
public function getResponseCookies()
238+
public function getResponseCookies(): ParameterBag
266239
{
267240
return new ParameterBag($this->data['response_cookies']->getValue());
268241
}
@@ -300,18 +273,12 @@ public function getContent()
300273
return $this->data['content'];
301274
}
302275

303-
/**
304-
* @return bool
305-
*/
306-
public function isJsonRequest()
276+
public function isJsonRequest(): bool
307277
{
308278
return 1 === preg_match('{^application/(?:\w+\++)*json$}i', $this->data['request_headers']['content-type']);
309279
}
310280

311-
/**
312-
* @return string|null
313-
*/
314-
public function getPrettyJson()
281+
public function getPrettyJson(): ?string
315282
{
316283
$decoded = json_decode($this->getContent());
317284

@@ -343,10 +310,7 @@ public function getLocale(): string
343310
return $this->data['locale'];
344311
}
345312

346-
/**
347-
* @return ParameterBag
348-
*/
349-
public function getDotenvVars()
313+
public function getDotenvVars(): ParameterBag
350314
{
351315
return new ParameterBag($this->data['dotenv_vars']->getValue());
352316
}

DataCollector/RouterDataCollector.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ public function collect(Request $request, Response $response, \Throwable $except
4848
unset($this->controllers[$request]);
4949
}
5050

51-
/**
52-
* @return void
53-
*/
54-
public function reset()
51+
public function reset(): void
5552
{
5653
$this->controllers = new \SplObjectStorage();
5754

@@ -62,20 +59,15 @@ public function reset()
6259
];
6360
}
6461

65-
/**
66-
* @return string
67-
*/
68-
protected function guessRoute(Request $request, string|object|array $controller)
62+
protected function guessRoute(Request $request, string|object|array $controller): string
6963
{
7064
return 'n/a';
7165
}
7266

7367
/**
7468
* Remembers the controller associated to each request.
75-
*
76-
* @return void
7769
*/
78-
public function onKernelController(ControllerEvent $event)
70+
public function onKernelController(ControllerEvent $event): void
7971
{
8072
$this->controllers[$event->getRequest()] = $event->getController();
8173
}

Debug/FileLinkFormatter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ public function __construct(string|array $fileLinkFormat = null, RequestStack $r
4949
$this->urlFormat = $urlFormat;
5050
}
5151

52-
/**
53-
* @return string|false
54-
*/
55-
public function format(string $file, int $line): string|bool
52+
public function format(string $file, int $line): string|false
5653
{
5754
if ($fmt = $this->getFileLinkFormat()) {
5855
for ($i = 1; isset($fmt[$i]); ++$i) {

Debug/TraceableEventDispatcher.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
*/
2424
class TraceableEventDispatcher extends BaseTraceableEventDispatcher
2525
{
26-
/**
27-
* @return void
28-
*/
29-
protected function beforeDispatch(string $eventName, object $event)
26+
protected function beforeDispatch(string $eventName, object $event): void
3027
{
3128
switch ($eventName) {
3229
case KernelEvents::REQUEST:
@@ -58,10 +55,7 @@ protected function beforeDispatch(string $eventName, object $event)
5855
}
5956
}
6057

61-
/**
62-
* @return void
63-
*/
64-
protected function afterDispatch(string $eventName, object $event)
58+
protected function afterDispatch(string $eventName, object $event): void
6559
{
6660
switch ($eventName) {
6761
case KernelEvents::CONTROLLER_ARGUMENTS:

DependencyInjection/AddAnnotatedClassesToCachePass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ public function __construct(Kernel $kernel)
3131
$this->kernel = $kernel;
3232
}
3333

34-
/**
35-
* @return void
36-
*/
37-
public function process(ContainerBuilder $container)
34+
public function process(ContainerBuilder $container): void
3835
{
3936
$annotatedClasses = [];
4037
foreach ($container->getExtensions() as $extension) {

DependencyInjection/ConfigurableExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ final public function load(array $configs, ContainerBuilder $container): void
3434

3535
/**
3636
* Configures the passed container according to the merged configuration.
37-
*
38-
* @return void
3937
*/
40-
abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container);
38+
abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void;
4139
}

DependencyInjection/ControllerArgumentValueResolverPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ class ControllerArgumentValueResolverPass implements CompilerPassInterface
3030
{
3131
use PriorityTaggedServiceTrait;
3232

33-
/**
34-
* @return void
35-
*/
36-
public function process(ContainerBuilder $container)
33+
public function process(ContainerBuilder $container): void
3734
{
3835
if (!$container->hasDefinition('argument_resolver')) {
3936
return;

DependencyInjection/Extension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ public function getAnnotatedClassesToCompile(): array
3434
* Adds annotated classes to the class cache.
3535
*
3636
* @param array $annotatedClasses An array of class patterns
37-
*
38-
* @return void
3937
*/
40-
public function addAnnotatedClassesToCompile(array $annotatedClasses)
38+
public function addAnnotatedClassesToCompile(array $annotatedClasses): void
4139
{
4240
$this->annotatedClasses = array_merge($this->annotatedClasses, $annotatedClasses);
4341
}

DependencyInjection/FragmentRendererPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
*/
2626
class FragmentRendererPass implements CompilerPassInterface
2727
{
28-
/**
29-
* @return void
30-
*/
31-
public function process(ContainerBuilder $container)
28+
public function process(ContainerBuilder $container): void
3229
{
3330
if (!$container->hasDefinition('fragment.handler')) {
3431
return;

0 commit comments

Comments
 (0)