Skip to content

Commit 5531067

Browse files
Add some missing return types to internal/final classes
1 parent 6366d6f commit 5531067

9 files changed

+49
-169
lines changed

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ public function enableOnlyOptionalWarmers()
4444
}
4545

4646
/**
47-
* Warms up the cache.
48-
*
49-
* @return string[] A list of classes or files to preload on PHP 7.4+
47+
* {@inheritdoc}
5048
*/
51-
public function warmUp(string $cacheDir)
49+
public function warmUp(string $cacheDir): array
5250
{
5351
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
5452
$collectedLogs = [];
@@ -114,7 +112,7 @@ public function warmUp(string $cacheDir)
114112
}
115113

116114
/**
117-
* Checks whether this warmer is optional or not.
115+
* {@inheritdoc}
118116
*/
119117
public function isOptional(): bool
120118
{

DataCollector/AjaxDataCollector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
use Symfony\Component\HttpFoundation\Response;
1616

1717
/**
18-
* AjaxDataCollector.
19-
*
2018
* @author Bart van den Burg <bart@burgov.nl>
2119
*
2220
* @final
@@ -33,7 +31,7 @@ public function reset()
3331
// all collecting is done client side
3432
}
3533

36-
public function getName()
34+
public function getName(): string
3735
{
3836
return 'ajax';
3937
}

DataCollector/ConfigDataCollector.php

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,16 @@ public function lateCollect()
9393

9494
/**
9595
* Gets the token.
96-
*
97-
* @return string|null
9896
*/
99-
public function getToken()
97+
public function getToken(): ?string
10098
{
10199
return $this->data['token'];
102100
}
103101

104102
/**
105103
* Gets the Symfony version.
106-
*
107-
* @return string
108104
*/
109-
public function getSymfonyVersion()
105+
public function getSymfonyVersion(): string
110106
{
111107
return $this->data['symfony_version'];
112108
}
@@ -116,18 +112,16 @@ public function getSymfonyVersion()
116112
*
117113
* @return string One of: unknown, dev, stable, eom, eol
118114
*/
119-
public function getSymfonyState()
115+
public function getSymfonyState(): string
120116
{
121117
return $this->data['symfony_state'];
122118
}
123119

124120
/**
125121
* Returns the minor Symfony version used (without patch numbers of extra
126122
* suffix like "RC", "beta", etc.).
127-
*
128-
* @return string
129123
*/
130-
public function getSymfonyMinorVersion()
124+
public function getSymfonyMinorVersion(): string
131125
{
132126
return $this->data['symfony_minor_version'];
133127
}
@@ -143,75 +137,59 @@ public function isSymfonyLts(): bool
143137
/**
144138
* Returns the human redable date when this Symfony version ends its
145139
* maintenance period.
146-
*
147-
* @return string
148140
*/
149-
public function getSymfonyEom()
141+
public function getSymfonyEom(): string
150142
{
151143
return $this->data['symfony_eom'];
152144
}
153145

154146
/**
155147
* Returns the human redable date when this Symfony version reaches its
156148
* "end of life" and won't receive bugs or security fixes.
157-
*
158-
* @return string
159149
*/
160-
public function getSymfonyEol()
150+
public function getSymfonyEol(): string
161151
{
162152
return $this->data['symfony_eol'];
163153
}
164154

165155
/**
166156
* Gets the PHP version.
167-
*
168-
* @return string
169157
*/
170-
public function getPhpVersion()
158+
public function getPhpVersion(): string
171159
{
172160
return $this->data['php_version'];
173161
}
174162

175163
/**
176164
* Gets the PHP version extra part.
177-
*
178-
* @return string|null
179165
*/
180-
public function getPhpVersionExtra()
166+
public function getPhpVersionExtra(): ?string
181167
{
182168
return $this->data['php_version_extra'] ?? null;
183169
}
184170

185171
/**
186172
* @return int The PHP architecture as number of bits (e.g. 32 or 64)
187173
*/
188-
public function getPhpArchitecture()
174+
public function getPhpArchitecture(): int
189175
{
190176
return $this->data['php_architecture'];
191177
}
192178

193-
/**
194-
* @return string
195-
*/
196-
public function getPhpIntlLocale()
179+
public function getPhpIntlLocale(): string
197180
{
198181
return $this->data['php_intl_locale'];
199182
}
200183

201-
/**
202-
* @return string
203-
*/
204-
public function getPhpTimezone()
184+
public function getPhpTimezone(): string
205185
{
206186
return $this->data['php_timezone'];
207187
}
208188

209189
/**
210190
* Gets the environment.
211-
*
212-
* @return string
213191
*/
214-
public function getEnv()
192+
public function getEnv(): string
215193
{
216194
return $this->data['env'];
217195
}
@@ -228,30 +206,24 @@ public function isDebug()
228206

229207
/**
230208
* Returns true if the XDebug is enabled.
231-
*
232-
* @return bool
233209
*/
234-
public function hasXDebug()
210+
public function hasXDebug(): bool
235211
{
236212
return $this->data['xdebug_enabled'];
237213
}
238214

239215
/**
240216
* Returns true if APCu is enabled.
241-
*
242-
* @return bool
243217
*/
244-
public function hasApcu()
218+
public function hasApcu(): bool
245219
{
246220
return $this->data['apcu_enabled'];
247221
}
248222

249223
/**
250224
* Returns true if Zend OPcache is enabled.
251-
*
252-
* @return bool
253225
*/
254-
public function hasZendOpcache()
226+
public function hasZendOpcache(): bool
255227
{
256228
return $this->data['zend_opcache_enabled'];
257229
}
@@ -263,18 +235,16 @@ public function getBundles()
263235

264236
/**
265237
* Gets the PHP SAPI name.
266-
*
267-
* @return string
268238
*/
269-
public function getSapiName()
239+
public function getSapiName(): string
270240
{
271241
return $this->data['sapi_name'];
272242
}
273243

274244
/**
275245
* {@inheritdoc}
276246
*/
277-
public function getName()
247+
public function getName(): string
278248
{
279249
return 'config';
280250
}

DataCollector/EventDataCollector.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
use Symfony\Contracts\Service\ResetInterface;
2020

2121
/**
22-
* EventDataCollector.
23-
*
2422
* @author Fabien Potencier <fabien@symfony.com>
2523
*
2624
* @final
@@ -71,8 +69,6 @@ public function lateCollect()
7169
}
7270

7371
/**
74-
* Sets the called listeners.
75-
*
7672
* @param array $listeners An array of called listeners
7773
*
7874
* @see TraceableEventDispatcher
@@ -83,20 +79,14 @@ public function setCalledListeners(array $listeners)
8379
}
8480

8581
/**
86-
* Gets the called listeners.
87-
*
88-
* @return array
89-
*
9082
* @see TraceableEventDispatcher
9183
*/
92-
public function getCalledListeners()
84+
public function getCalledListeners(): array
9385
{
9486
return $this->data['called_listeners'];
9587
}
9688

9789
/**
98-
* Sets the not called listeners.
99-
*
10090
* @see TraceableEventDispatcher
10191
*/
10292
public function setNotCalledListeners(array $listeners)
@@ -105,20 +95,14 @@ public function setNotCalledListeners(array $listeners)
10595
}
10696

10797
/**
108-
* Gets the not called listeners.
109-
*
110-
* @return array
111-
*
11298
* @see TraceableEventDispatcher
11399
*/
114-
public function getNotCalledListeners()
100+
public function getNotCalledListeners(): array
115101
{
116102
return $this->data['not_called_listeners'];
117103
}
118104

119105
/**
120-
* Sets the orphaned events.
121-
*
122106
* @param array $events An array of orphaned events
123107
*
124108
* @see TraceableEventDispatcher
@@ -129,21 +113,17 @@ public function setOrphanedEvents(array $events)
129113
}
130114

131115
/**
132-
* Gets the orphaned events.
133-
*
134-
* @return array
135-
*
136116
* @see TraceableEventDispatcher
137117
*/
138-
public function getOrphanedEvents()
118+
public function getOrphanedEvents(): array
139119
{
140120
return $this->data['orphaned_events'];
141121
}
142122

143123
/**
144124
* {@inheritdoc}
145125
*/
146-
public function getName()
126+
public function getName(): string
147127
{
148128
return 'events';
149129
}

DataCollector/ExceptionDataCollector.php

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717

1818
/**
19-
* ExceptionDataCollector.
20-
*
2119
* @author Fabien Potencier <fabien@symfony.com>
2220
*
2321
* @final
@@ -44,70 +42,43 @@ public function reset()
4442
$this->data = [];
4543
}
4644

47-
/**
48-
* Checks if the exception is not null.
49-
*
50-
* @return bool
51-
*/
52-
public function hasException()
45+
public function hasException(): bool
5346
{
5447
return isset($this->data['exception']);
5548
}
5649

5750
/**
58-
* Gets the exception.
59-
*
6051
* @return \Exception|FlattenException
6152
*/
6253
public function getException()
6354
{
6455
return $this->data['exception'];
6556
}
6657

67-
/**
68-
* Gets the exception message.
69-
*
70-
* @return string
71-
*/
72-
public function getMessage()
58+
public function getMessage(): string
7359
{
7460
return $this->data['exception']->getMessage();
7561
}
7662

77-
/**
78-
* Gets the exception code.
79-
*
80-
* @return int
81-
*/
82-
public function getCode()
63+
public function getCode(): int
8364
{
8465
return $this->data['exception']->getCode();
8566
}
8667

87-
/**
88-
* Gets the status code.
89-
*
90-
* @return int
91-
*/
92-
public function getStatusCode()
68+
public function getStatusCode(): int
9369
{
9470
return $this->data['exception']->getStatusCode();
9571
}
9672

97-
/**
98-
* Gets the exception trace.
99-
*
100-
* @return array
101-
*/
102-
public function getTrace()
73+
public function getTrace(): array
10374
{
10475
return $this->data['exception']->getTrace();
10576
}
10677

10778
/**
10879
* {@inheritdoc}
10980
*/
110-
public function getName()
81+
public function getName(): string
11182
{
11283
return 'exception';
11384
}

0 commit comments

Comments
 (0)