Skip to content

Commit c9efdee

Browse files
Add return types - batch 3/n
1 parent 9004e35 commit c9efdee

File tree

103 files changed

+437
-435
lines changed

Some content is hidden

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

103 files changed

+437
-435
lines changed

src/Symfony/Component/HttpFoundation/AcceptHeader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(array $items)
4949
*
5050
* @return self
5151
*/
52-
public static function fromString(?string $headerValue)
52+
public static function fromString(?string $headerValue): \Symfony\Component\HttpFoundation\AcceptHeader
5353
{
5454
$index = 0;
5555

@@ -79,7 +79,7 @@ public function __toString(): string
7979
*
8080
* @return bool
8181
*/
82-
public function has(string $value)
82+
public function has(string $value): bool
8383
{
8484
return isset($this->items[$value]);
8585
}
@@ -89,7 +89,7 @@ public function has(string $value)
8989
*
9090
* @return AcceptHeaderItem|null
9191
*/
92-
public function get(string $value)
92+
public function get(string $value): ?AcceptHeaderItem
9393
{
9494
return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null;
9595
}
@@ -99,7 +99,7 @@ public function get(string $value)
9999
*
100100
* @return $this
101101
*/
102-
public function add(AcceptHeaderItem $item)
102+
public function add(AcceptHeaderItem $item): static
103103
{
104104
$this->items[$item->getValue()] = $item;
105105
$this->sorted = false;
@@ -112,7 +112,7 @@ public function add(AcceptHeaderItem $item)
112112
*
113113
* @return AcceptHeaderItem[]
114114
*/
115-
public function all()
115+
public function all(): array
116116
{
117117
$this->sort();
118118

@@ -124,7 +124,7 @@ public function all()
124124
*
125125
* @return self
126126
*/
127-
public function filter(string $pattern)
127+
public function filter(string $pattern): \Symfony\Component\HttpFoundation\AcceptHeader
128128
{
129129
return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
130130
return preg_match($pattern, $item->getValue());
@@ -136,7 +136,7 @@ public function filter(string $pattern)
136136
*
137137
* @return AcceptHeaderItem|null
138138
*/
139-
public function first()
139+
public function first(): ?AcceptHeaderItem
140140
{
141141
$this->sort();
142142

src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(string $value, array $attributes = [])
3636
*
3737
* @return self
3838
*/
39-
public static function fromString(?string $itemValue)
39+
public static function fromString(?string $itemValue): \Symfony\Component\HttpFoundation\AcceptHeaderItem
4040
{
4141
$parts = HeaderUtils::split($itemValue ?? '', ';=');
4242

@@ -64,7 +64,7 @@ public function __toString(): string
6464
*
6565
* @return $this
6666
*/
67-
public function setValue(string $value)
67+
public function setValue(string $value): static
6868
{
6969
$this->value = $value;
7070

@@ -76,7 +76,7 @@ public function setValue(string $value)
7676
*
7777
* @return string
7878
*/
79-
public function getValue()
79+
public function getValue(): string
8080
{
8181
return $this->value;
8282
}
@@ -86,7 +86,7 @@ public function getValue()
8686
*
8787
* @return $this
8888
*/
89-
public function setQuality(float $quality)
89+
public function setQuality(float $quality): static
9090
{
9191
$this->quality = $quality;
9292

@@ -98,7 +98,7 @@ public function setQuality(float $quality)
9898
*
9999
* @return float
100100
*/
101-
public function getQuality()
101+
public function getQuality(): float
102102
{
103103
return $this->quality;
104104
}
@@ -108,7 +108,7 @@ public function getQuality()
108108
*
109109
* @return $this
110110
*/
111-
public function setIndex(int $index)
111+
public function setIndex(int $index): static
112112
{
113113
$this->index = $index;
114114

@@ -120,7 +120,7 @@ public function setIndex(int $index)
120120
*
121121
* @return int
122122
*/
123-
public function getIndex()
123+
public function getIndex(): int
124124
{
125125
return $this->index;
126126
}
@@ -130,7 +130,7 @@ public function getIndex()
130130
*
131131
* @return bool
132132
*/
133-
public function hasAttribute(string $name)
133+
public function hasAttribute(string $name): bool
134134
{
135135
return isset($this->attributes[$name]);
136136
}
@@ -140,7 +140,7 @@ public function hasAttribute(string $name)
140140
*
141141
* @return mixed
142142
*/
143-
public function getAttribute(string $name, mixed $default = null)
143+
public function getAttribute(string $name, mixed $default = null): mixed
144144
{
145145
return $this->attributes[$name] ?? $default;
146146
}
@@ -150,7 +150,7 @@ public function getAttribute(string $name, mixed $default = null)
150150
*
151151
* @return array
152152
*/
153-
public function getAttributes()
153+
public function getAttributes(): array
154154
{
155155
return $this->attributes;
156156
}
@@ -160,7 +160,7 @@ public function getAttributes()
160160
*
161161
* @return $this
162162
*/
163-
public function setAttribute(string $name, string $value)
163+
public function setAttribute(string $name, string $value): static
164164
{
165165
if ('q' === $name) {
166166
$this->quality = (float) $value;

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(\SplFileInfo|string $file, int $status = 200, array
6262
*
6363
* @throws FileException
6464
*/
65-
public function setFile(\SplFileInfo|string $file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
65+
public function setFile(\SplFileInfo|string $file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true): static
6666
{
6767
if (!$file instanceof File) {
6868
if ($file instanceof \SplFileInfo) {
@@ -98,7 +98,7 @@ public function setFile(\SplFileInfo|string $file, string $contentDisposition =
9898
*
9999
* @return File The file to stream
100100
*/
101-
public function getFile()
101+
public function getFile(): File
102102
{
103103
return $this->file;
104104
}
@@ -132,7 +132,7 @@ public function setAutoEtag()
132132
*
133133
* @return $this
134134
*/
135-
public function setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = '')
135+
public function setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = ''): static
136136
{
137137
if ('' === $filename) {
138138
$filename = $this->file->getFilename();
@@ -161,7 +161,7 @@ public function setContentDisposition(string $disposition, string $filename = ''
161161
/**
162162
* {@inheritdoc}
163163
*/
164-
public function prepare(Request $request)
164+
public function prepare(Request $request): static
165165
{
166166
if (!$this->headers->has('Content-Type')) {
167167
$this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream');
@@ -269,7 +269,7 @@ private function hasValidIfRangeHeader(?string $header): bool
269269
*
270270
* {@inheritdoc}
271271
*/
272-
public function sendContent()
272+
public function sendContent(): static
273273
{
274274
if (!$this->isSuccessful()) {
275275
return parent::sendContent();
@@ -299,7 +299,7 @@ public function sendContent()
299299
*
300300
* @throws \LogicException when the content is not null
301301
*/
302-
public function setContent(?string $content)
302+
public function setContent(?string $content): static
303303
{
304304
if (null !== $content) {
305305
throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.');
@@ -311,7 +311,7 @@ public function setContent(?string $content)
311311
/**
312312
* {@inheritdoc}
313313
*/
314-
public function getContent()
314+
public function getContent(): string|false
315315
{
316316
return false;
317317
}
@@ -330,7 +330,7 @@ public static function trustXSendfileTypeHeader()
330330
*
331331
* @return $this
332332
*/
333-
public function deleteFileAfterSend(bool $shouldDelete = true)
333+
public function deleteFileAfterSend(bool $shouldDelete = true): static
334334
{
335335
$this->deleteFileAfterSend = $shouldDelete;
336336

0 commit comments

Comments
 (0)