Skip to content

Commit e29fb65

Browse files
wouterjnicolas-grekas
authored andcommitted
Add void return types
1 parent 968650f commit e29fb65

21 files changed

+230
-4
lines changed

BinaryFileResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ public function getContent(): string|false
351351

352352
/**
353353
* Trust X-Sendfile-Type header.
354+
*
355+
* @return void
354356
*/
355357
public static function trustXSendfileTypeHeader()
356358
{

ExpressionRequestMatcher.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class ExpressionRequestMatcher extends RequestMatcher
2929
private ExpressionLanguage $language;
3030
private Expression|string $expression;
3131

32+
/**
33+
* @return void
34+
*/
3235
public function setExpression(ExpressionLanguage $language, Expression|string $expression)
3336
{
3437
$this->language = $language;

FileBag.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ public function __construct(array $parameters = [])
3131
$this->replace($parameters);
3232
}
3333

34+
/**
35+
* @return void
36+
*/
3437
public function replace(array $files = [])
3538
{
3639
$this->parameters = [];
3740
$this->add($files);
3841
}
3942

43+
/**
44+
* @return void
45+
*/
4046
public function set(string $key, mixed $value)
4147
{
4248
if (!\is_array($value) && !$value instanceof UploadedFile) {
@@ -46,6 +52,9 @@ public function set(string $key, mixed $value)
4652
parent::set($key, $this->convertFileInformation($value));
4753
}
4854

55+
/**
56+
* @return void
57+
*/
4958
public function add(array $files = [])
5059
{
5160
foreach ($files as $key => $file) {

HeaderBag.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public function keys(): array
8686

8787
/**
8888
* Replaces the current HTTP headers by a new set.
89+
*
90+
* @return void
8991
*/
9092
public function replace(array $headers = [])
9193
{
@@ -95,6 +97,8 @@ public function replace(array $headers = [])
9597

9698
/**
9799
* Adds new headers the current HTTP headers set.
100+
*
101+
* @return void
98102
*/
99103
public function add(array $headers)
100104
{
@@ -126,6 +130,8 @@ public function get(string $key, string $default = null): ?string
126130
*
127131
* @param string|string[]|null $values The value or an array of values
128132
* @param bool $replace Whether to replace the actual value or not (true by default)
133+
*
134+
* @return void
129135
*/
130136
public function set(string $key, string|array|null $values, bool $replace = true)
131137
{
@@ -170,6 +176,8 @@ public function contains(string $key, string $value): bool
170176

171177
/**
172178
* Removes a header.
179+
*
180+
* @return void
173181
*/
174182
public function remove(string $key)
175183
{
@@ -202,6 +210,8 @@ public function getDate(string $key, \DateTime $default = null): ?\DateTimeInter
202210

203211
/**
204212
* Adds a custom Cache-Control directive.
213+
*
214+
* @return void
205215
*/
206216
public function addCacheControlDirective(string $key, bool|string $value = true)
207217
{
@@ -228,6 +238,8 @@ public function getCacheControlDirective(string $key): bool|string|null
228238

229239
/**
230240
* Removes a Cache-Control directive.
241+
*
242+
* @return void
231243
*/
232244
public function removeCacheControlDirective(string $key)
233245
{

InputBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function get(string $key, mixed $default = null): string|int|float|bool|n
4343
/**
4444
* Replaces the current input values by a new set.
4545
*/
46-
public function replace(array $inputs = [])
46+
public function replace(array $inputs = []): void
4747
{
4848
$this->parameters = [];
4949
$this->add($inputs);
@@ -52,7 +52,7 @@ public function replace(array $inputs = [])
5252
/**
5353
* Adds input values.
5454
*/
55-
public function add(array $inputs = [])
55+
public function add(array $inputs = []): void
5656
{
5757
foreach ($inputs as $input => $value) {
5858
$this->set($input, $value);
@@ -64,7 +64,7 @@ public function add(array $inputs = [])
6464
*
6565
* @param string|int|float|bool|array|null $value
6666
*/
67-
public function set(string $key, mixed $value)
67+
public function set(string $key, mixed $value): void
6868
{
6969
if (null !== $value && !\is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) {
7070
throw new \InvalidArgumentException(sprintf('Expected a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));

ParameterBag.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public function keys(): array
6060

6161
/**
6262
* Replaces the current parameters by a new set.
63+
*
64+
* @return void
6365
*/
6466
public function replace(array $parameters = [])
6567
{
@@ -68,6 +70,8 @@ public function replace(array $parameters = [])
6870

6971
/**
7072
* Adds parameters.
73+
*
74+
* @return void
7175
*/
7276
public function add(array $parameters = [])
7377
{
@@ -79,6 +83,9 @@ public function get(string $key, mixed $default = null): mixed
7983
return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
8084
}
8185

86+
/**
87+
* @return void
88+
*/
8289
public function set(string $key, mixed $value)
8390
{
8491
$this->parameters[$key] = $value;
@@ -94,6 +101,8 @@ public function has(string $key): bool
94101

95102
/**
96103
* Removes a parameter.
104+
*
105+
* @return void
97106
*/
98107
public function remove(string $key)
99108
{

Request.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ public function __construct(array $query = [], array $request = [], array $attri
263263
* @param array $files The FILES parameters
264264
* @param array $server The SERVER parameters
265265
* @param string|resource|null $content The raw body data
266+
*
267+
* @return void
266268
*/
267269
public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
268270
{
@@ -417,6 +419,8 @@ public static function create(string $uri, string $method = 'GET', array $parame
417419
* This is mainly useful when you need to override the Request class
418420
* to keep BC with an existing system. It should not be used for any
419421
* other purpose.
422+
*
423+
* @return void
420424
*/
421425
public static function setFactory(?callable $callable)
422426
{
@@ -521,6 +525,8 @@ public function __toString(): string
521525
*
522526
* It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE.
523527
* $_FILES is never overridden, see rfc1867
528+
*
529+
* @return void
524530
*/
525531
public function overrideGlobals()
526532
{
@@ -561,6 +567,8 @@ public function overrideGlobals()
561567
*
562568
* @param array $proxies A list of trusted proxies, the string 'REMOTE_ADDR' will be replaced with $_SERVER['REMOTE_ADDR']
563569
* @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies
570+
*
571+
* @return void
564572
*/
565573
public static function setTrustedProxies(array $proxies, int $trustedHeaderSet)
566574
{
@@ -602,6 +610,8 @@ public static function getTrustedHeaderSet(): int
602610
* You should only list the hosts you manage using regexs.
603611
*
604612
* @param array $hostPatterns A list of trusted host patterns
613+
*
614+
* @return void
605615
*/
606616
public static function setTrustedHosts(array $hostPatterns)
607617
{
@@ -648,6 +658,8 @@ public static function normalizeQueryString(?string $qs): string
648658
* If these methods are not protected against CSRF, this presents a possible vulnerability.
649659
*
650660
* The HTTP method can only be overridden when the real HTTP method is POST.
661+
*
662+
* @return void
651663
*/
652664
public static function enableHttpMethodParameterOverride()
653665
{
@@ -733,6 +745,9 @@ public function hasSession(bool $skipIfUninitialized = false): bool
733745
return null !== $this->session && (!$skipIfUninitialized || $this->session instanceof SessionInterface);
734746
}
735747

748+
/**
749+
* @return void
750+
*/
736751
public function setSession(SessionInterface $session)
737752
{
738753
$this->session = $session;
@@ -743,7 +758,7 @@ public function setSession(SessionInterface $session)
743758
*
744759
* @param callable(): SessionInterface $factory
745760
*/
746-
public function setSessionFactory(callable $factory)
761+
public function setSessionFactory(callable $factory): void
747762
{
748763
$this->session = $factory;
749764
}
@@ -1153,6 +1168,8 @@ public function getHost(): string
11531168

11541169
/**
11551170
* Sets the request method.
1171+
*
1172+
* @return void
11561173
*/
11571174
public function setMethod(string $method)
11581175
{
@@ -1274,6 +1291,8 @@ public function getFormat(?string $mimeType): ?string
12741291
* Associates a format with mime types.
12751292
*
12761293
* @param string|string[] $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type)
1294+
*
1295+
* @return void
12771296
*/
12781297
public function setFormat(?string $format, string|array $mimeTypes)
12791298
{
@@ -1304,6 +1323,8 @@ public function getRequestFormat(?string $default = 'html'): ?string
13041323

13051324
/**
13061325
* Sets the request format.
1326+
*
1327+
* @return void
13071328
*/
13081329
public function setRequestFormat(?string $format)
13091330
{
@@ -1334,6 +1355,8 @@ public function getContentTypeFormat(): ?string
13341355

13351356
/**
13361357
* Sets the default locale.
1358+
*
1359+
* @return void
13371360
*/
13381361
public function setDefaultLocale(string $locale)
13391362
{
@@ -1354,6 +1377,8 @@ public function getDefaultLocale(): string
13541377

13551378
/**
13561379
* Sets the locale.
1380+
*
1381+
* @return void
13571382
*/
13581383
public function setLocale(string $locale)
13591384
{
@@ -1858,6 +1883,8 @@ protected function preparePathInfo(): string
18581883

18591884
/**
18601885
* Initializes HTTP request formats.
1886+
*
1887+
* @return void
18611888
*/
18621889
protected static function initializeFormats()
18631890
{

RequestMatcher.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public function __construct(string $path = null, string $host = null, string|arr
6969
* Adds a check for the HTTP scheme.
7070
*
7171
* @param string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes
72+
*
73+
* @return void
7274
*/
7375
public function matchScheme(string|array|null $scheme)
7476
{
@@ -77,6 +79,8 @@ public function matchScheme(string|array|null $scheme)
7779

7880
/**
7981
* Adds a check for the URL host name.
82+
*
83+
* @return void
8084
*/
8185
public function matchHost(?string $regexp)
8286
{
@@ -87,6 +91,8 @@ public function matchHost(?string $regexp)
8791
* Adds a check for the the URL port.
8892
*
8993
* @param int|null $port The port number to connect to
94+
*
95+
* @return void
9096
*/
9197
public function matchPort(?int $port)
9298
{
@@ -95,6 +101,8 @@ public function matchPort(?int $port)
95101

96102
/**
97103
* Adds a check for the URL path info.
104+
*
105+
* @return void
98106
*/
99107
public function matchPath(?string $regexp)
100108
{
@@ -105,6 +113,8 @@ public function matchPath(?string $regexp)
105113
* Adds a check for the client IP.
106114
*
107115
* @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24
116+
*
117+
* @return void
108118
*/
109119
public function matchIp(string $ip)
110120
{
@@ -115,6 +125,8 @@ public function matchIp(string $ip)
115125
* Adds a check for the client IP.
116126
*
117127
* @param string|string[]|null $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24
128+
*
129+
* @return void
118130
*/
119131
public function matchIps(string|array|null $ips)
120132
{
@@ -127,6 +139,8 @@ public function matchIps(string|array|null $ips)
127139
* Adds a check for the HTTP method.
128140
*
129141
* @param string|string[]|null $method An HTTP method or an array of HTTP methods
142+
*
143+
* @return void
130144
*/
131145
public function matchMethod(string|array|null $method)
132146
{
@@ -135,6 +149,8 @@ public function matchMethod(string|array|null $method)
135149

136150
/**
137151
* Adds a check for request attribute.
152+
*
153+
* @return void
138154
*/
139155
public function matchAttribute(string $key, string $regexp)
140156
{

RequestStack.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class RequestStack
3131
*
3232
* This method should generally not be called directly as the stack
3333
* management should be taken care of by the application itself.
34+
*
35+
* @return void
3436
*/
3537
public function push(Request $request)
3638
{

0 commit comments

Comments
 (0)