Skip to content

Commit 8f814f2

Browse files
Add return types, round 1
1 parent 48fde7b commit 8f814f2

11 files changed

+51
-236
lines changed

CacheWarmer/CacheWarmerAggregate.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function enableOnlyOptionalWarmers()
4848
*
4949
* @return string[] A list of classes or files to preload on PHP 7.4+
5050
*/
51-
public function warmUp(string $cacheDir)
51+
public function warmUp(string $cacheDir): array
5252
{
5353
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
5454
$collectedLogs = [];
@@ -114,9 +114,7 @@ public function warmUp(string $cacheDir)
114114
}
115115

116116
/**
117-
* Checks whether this warmer is optional or not.
118-
*
119-
* @return bool always false
117+
* {@inheritdoc}
120118
*/
121119
public function isOptional(): bool
122120
{

DataCollector/AjaxDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function reset()
3333
// all collecting is done client side
3434
}
3535

36-
public function getName()
36+
public function getName(): string
3737
{
3838
return 'ajax';
3939
}

DataCollector/ConfigDataCollector.php

Lines changed: 19 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -91,50 +91,34 @@ public function lateCollect()
9191
$this->data = $this->cloneVar($this->data);
9292
}
9393

94-
/**
95-
* Gets the token.
96-
*
97-
* @return string|null The token
98-
*/
99-
public function getToken()
94+
public function getToken(): ?string
10095
{
10196
return $this->data['token'];
10297
}
10398

104-
/**
105-
* Gets the Symfony version.
106-
*
107-
* @return string The Symfony version
108-
*/
109-
public function getSymfonyVersion()
99+
public function getSymfonyVersion(): string
110100
{
111101
return $this->data['symfony_version'];
112102
}
113103

114104
/**
115-
* Returns the state of the current Symfony release.
116-
*
117-
* @return string One of: unknown, dev, stable, eom, eol
105+
* Returns the state of the current Symfony release
106+
* as one of: unknown, dev, stable, eom, eol.
118107
*/
119-
public function getSymfonyState()
108+
public function getSymfonyState(): string
120109
{
121110
return $this->data['symfony_state'];
122111
}
123112

124113
/**
125114
* Returns the minor Symfony version used (without patch numbers of extra
126115
* suffix like "RC", "beta", etc.).
127-
*
128-
* @return string
129116
*/
130-
public function getSymfonyMinorVersion()
117+
public function getSymfonyMinorVersion(): string
131118
{
132119
return $this->data['symfony_minor_version'];
133120
}
134121

135-
/**
136-
* Returns if the current Symfony version is a Long-Term Support one.
137-
*/
138122
public function isSymfonyLts(): bool
139123
{
140124
return $this->data['symfony_lts'];
@@ -143,75 +127,47 @@ public function isSymfonyLts(): bool
143127
/**
144128
* Returns the human redable date when this Symfony version ends its
145129
* maintenance period.
146-
*
147-
* @return string
148130
*/
149-
public function getSymfonyEom()
131+
public function getSymfonyEom(): string
150132
{
151133
return $this->data['symfony_eom'];
152134
}
153135

154136
/**
155137
* Returns the human redable date when this Symfony version reaches its
156138
* "end of life" and won't receive bugs or security fixes.
157-
*
158-
* @return string
159139
*/
160-
public function getSymfonyEol()
140+
public function getSymfonyEol(): string
161141
{
162142
return $this->data['symfony_eol'];
163143
}
164144

165-
/**
166-
* Gets the PHP version.
167-
*
168-
* @return string The PHP version
169-
*/
170-
public function getPhpVersion()
145+
public function getPhpVersion(): string
171146
{
172147
return $this->data['php_version'];
173148
}
174149

175-
/**
176-
* Gets the PHP version extra part.
177-
*
178-
* @return string|null The extra part
179-
*/
180-
public function getPhpVersionExtra()
150+
public function getPhpVersionExtra(): ?string
181151
{
182152
return $this->data['php_version_extra'] ?? null;
183153
}
184154

185-
/**
186-
* @return int The PHP architecture as number of bits (e.g. 32 or 64)
187-
*/
188-
public function getPhpArchitecture()
155+
public function getPhpArchitecture(): int
189156
{
190157
return $this->data['php_architecture'];
191158
}
192159

193-
/**
194-
* @return string
195-
*/
196-
public function getPhpIntlLocale()
160+
public function getPhpIntlLocale(): string
197161
{
198162
return $this->data['php_intl_locale'];
199163
}
200164

201-
/**
202-
* @return string
203-
*/
204-
public function getPhpTimezone()
165+
public function getPhpTimezone(): string
205166
{
206167
return $this->data['php_timezone'];
207168
}
208169

209-
/**
210-
* Gets the environment.
211-
*
212-
* @return string The environment
213-
*/
214-
public function getEnv()
170+
public function getEnv(): string
215171
{
216172
return $this->data['env'];
217173
}
@@ -226,32 +182,17 @@ public function isDebug()
226182
return $this->data['debug'];
227183
}
228184

229-
/**
230-
* Returns true if the XDebug is enabled.
231-
*
232-
* @return bool true if XDebug is enabled, false otherwise
233-
*/
234-
public function hasXDebug()
185+
public function hasXDebug(): bool
235186
{
236187
return $this->data['xdebug_enabled'];
237188
}
238189

239-
/**
240-
* Returns true if APCu is enabled.
241-
*
242-
* @return bool true if APCu is enabled, false otherwise
243-
*/
244-
public function hasApcu()
190+
public function hasApcu(): bool
245191
{
246192
return $this->data['apcu_enabled'];
247193
}
248194

249-
/**
250-
* Returns true if Zend OPcache is enabled.
251-
*
252-
* @return bool true if Zend OPcache is enabled, false otherwise
253-
*/
254-
public function hasZendOpcache()
195+
public function hasZendOpcache(): bool
255196
{
256197
return $this->data['zend_opcache_enabled'];
257198
}
@@ -261,29 +202,19 @@ public function getBundles()
261202
return $this->data['bundles'];
262203
}
263204

264-
/**
265-
* Gets the PHP SAPI name.
266-
*
267-
* @return string The environment
268-
*/
269-
public function getSapiName()
205+
public function getSapiName(): string
270206
{
271207
return $this->data['sapi_name'];
272208
}
273209

274210
/**
275211
* {@inheritdoc}
276212
*/
277-
public function getName()
213+
public function getName(): string
278214
{
279215
return 'config';
280216
}
281217

282-
/**
283-
* Tries to retrieve information about the current Symfony version.
284-
*
285-
* @return string One of: dev, stable, eom, eol
286-
*/
287218
private function determineSymfonyState(): string
288219
{
289220
$now = new \DateTime();

DataCollector/EventDataCollector.php

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

2121
/**
22-
* EventDataCollector.
23-
*
2422
* @author Fabien Potencier <fabien@symfony.com>
2523
*
24+
* @see TraceableEventDispatcher
25+
*
2626
* @final
2727
*/
2828
class EventDataCollector extends DataCollector implements LateDataCollectorInterface
@@ -70,80 +70,40 @@ public function lateCollect()
7070
$this->data = $this->cloneVar($this->data);
7171
}
7272

73-
/**
74-
* Sets the called listeners.
75-
*
76-
* @param array $listeners An array of called listeners
77-
*
78-
* @see TraceableEventDispatcher
79-
*/
8073
public function setCalledListeners(array $listeners)
8174
{
8275
$this->data['called_listeners'] = $listeners;
8376
}
8477

85-
/**
86-
* Gets the called listeners.
87-
*
88-
* @return array An array of called listeners
89-
*
90-
* @see TraceableEventDispatcher
91-
*/
92-
public function getCalledListeners()
78+
public function getCalledListeners(): array
9379
{
9480
return $this->data['called_listeners'];
9581
}
9682

97-
/**
98-
* Sets the not called listeners.
99-
*
100-
* @see TraceableEventDispatcher
101-
*/
10283
public function setNotCalledListeners(array $listeners)
10384
{
10485
$this->data['not_called_listeners'] = $listeners;
10586
}
10687

107-
/**
108-
* Gets the not called listeners.
109-
*
110-
* @return array
111-
*
112-
* @see TraceableEventDispatcher
113-
*/
114-
public function getNotCalledListeners()
88+
public function getNotCalledListeners(): array
11589
{
11690
return $this->data['not_called_listeners'];
11791
}
11892

119-
/**
120-
* Sets the orphaned events.
121-
*
122-
* @param array $events An array of orphaned events
123-
*
124-
* @see TraceableEventDispatcher
125-
*/
12693
public function setOrphanedEvents(array $events)
12794
{
12895
$this->data['orphaned_events'] = $events;
12996
}
13097

131-
/**
132-
* Gets the orphaned events.
133-
*
134-
* @return array An array of orphaned events
135-
*
136-
* @see TraceableEventDispatcher
137-
*/
138-
public function getOrphanedEvents()
98+
public function getOrphanedEvents(): array
13999
{
140100
return $this->data['orphaned_events'];
141101
}
142102

143103
/**
144104
* {@inheritdoc}
145105
*/
146-
public function getName()
106+
public function getName(): string
147107
{
148108
return 'events';
149109
}

0 commit comments

Comments
 (0)