Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff98eff

Browse files
minor #50185 [HttpClient][HttpFoundation][HttpKernel][Ldap][Mailer][Mime][Process][Routing][Security][Serializer][Translation][Validator] Add missing return types (wouterj)
This PR was merged into the 6.3 branch. Discussion ---------- [HttpClient][HttpFoundation][HttpKernel][Ldap][Mailer][Mime][Process][Routing][Security][Serializer][Translation][Validator] Add missing return types | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Ref #47551 | License | MIT | Doc PR | - Last one, for the components. Only some bundle methods are missing now. Commits ------- f86dbbd Add missing return types
2 parents 5229f16 + f86dbbd commit ff98eff

File tree

26 files changed

+288
-66
lines changed

26 files changed

+288
-66
lines changed

.github/expected-missing-return-types.diff

Lines changed: 196 additions & 42 deletions
Large diffs are not rendered by default.

src/Symfony/Component/HttpClient/Response/StreamWrapper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class StreamWrapper
3232
/** @var resource|string|null */
3333
private $content;
3434

35-
/** @var resource|null */
35+
/** @var resource|callable|null */
3636
private $handle;
3737

3838
private bool $blocking = true;
@@ -266,6 +266,9 @@ public function stream_seek(int $offset, int $whence = \SEEK_SET): bool
266266
return false;
267267
}
268268

269+
/**
270+
* @return resource|false
271+
*/
269272
public function stream_cast(int $castAs)
270273
{
271274
if (\STREAM_CAST_FOR_SELECT === $castAs) {

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,9 @@ public function preferSafeContent(): bool
17321732
* Copyright (c) 2005-2010 Zend Technologies USA Inc. (https://www.zend.com/)
17331733
*/
17341734

1735+
/**
1736+
* @return string
1737+
*/
17351738
protected function prepareRequestUri()
17361739
{
17371740
$requestUri = '';

src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ 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
3739
*/
3840
abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container);
3941
}

src/Symfony/Component/Ldap/Security/LdapUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function loadUser(string $identifier, Entry $entry): UserInterface
167167
return new LdapUser($entry, $identifier, $password, $this->defaultRoles, $extraFields);
168168
}
169169

170-
private function getAttributeValue(Entry $entry, string $attribute)
170+
private function getAttributeValue(Entry $entry, string $attribute): mixed
171171
{
172172
if (!$entry->hasAttribute($attribute)) {
173173
throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $attribute, $entry->getDn()));

src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function getEndpoint(): ?string
199199
return ($this->host ?: self::HOST).($this->port ? ':'.$this->port : '');
200200
}
201201

202-
private function castCustomHeader(string $value, string $type)
202+
private function castCustomHeader(string $value, string $type): mixed
203203
{
204204
return match ($type) {
205205
'bool' => filter_var($value, \FILTER_VALIDATE_BOOL),

src/Symfony/Component/Mime/Email.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ public function getBody(): AbstractPart
396396
return $this->generateBody();
397397
}
398398

399+
/**
400+
* @return void
401+
*/
399402
public function ensureValidity()
400403
{
401404
$this->ensureBodyValid();

src/Symfony/Component/Process/Exception/ProcessFailedException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function __construct(Process $process)
4747
$this->process = $process;
4848
}
4949

50+
/**
51+
* @return Process
52+
*/
5053
public function getProcess()
5154
{
5255
return $this->process;

src/Symfony/Component/Process/Exception/ProcessTimedOutException.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function __construct(Process $process, int $timeoutType)
3838
));
3939
}
4040

41+
/**
42+
* @return Process
43+
*/
4144
public function getProcess()
4245
{
4346
return $this->process;
@@ -59,7 +62,7 @@ public function isIdleTimeout()
5962
return self::TYPE_IDLE === $this->timeoutType;
6063
}
6164

62-
public function getExceededTimeout()
65+
public function getExceededTimeout(): ?float
6366
{
6467
return match ($this->timeoutType) {
6568
self::TYPE_GENERAL => $this->process->getTimeout(),

src/Symfony/Component/Process/Process.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public function mustRun(callable $callback = null, array $env = []): static
285285
* @param callable|null $callback A PHP callback to run whenever there is some
286286
* output available on STDOUT or STDERR
287287
*
288+
* @return void
289+
*
288290
* @throws RuntimeException When process can't be launched
289291
* @throws RuntimeException When process is already running
290292
* @throws LogicException In case a callback is provided and output has been disabled
@@ -1140,6 +1142,8 @@ public function setInput(mixed $input): static
11401142
* In case you run a background process (with the start method), you should
11411143
* trigger this method regularly to ensure the process timeout
11421144
*
1145+
* @return void
1146+
*
11431147
* @throws ProcessTimedOutException In case the timeout was reached
11441148
*/
11451149
public function checkTimeout()
@@ -1180,6 +1184,8 @@ public function getStartTime(): float
11801184
*
11811185
* Enabling the "create_new_console" option allows a subprocess to continue
11821186
* to run after the main process exited, on both Windows and *nix
1187+
*
1188+
* @return void
11831189
*/
11841190
public function setOptions(array $options)
11851191
{
@@ -1275,6 +1281,8 @@ protected function buildCallback(callable $callback = null): \Closure
12751281
* Updates the status of the process, reads pipes.
12761282
*
12771283
* @param bool $blocking Whether to use a blocking read call
1284+
*
1285+
* @return void
12781286
*/
12791287
protected function updateStatus(bool $blocking)
12801288
{
@@ -1323,7 +1331,7 @@ protected function isSigchildEnabled(): bool
13231331
*
13241332
* @throws LogicException in case output has been disabled or process is not started
13251333
*/
1326-
private function readPipesForOutput(string $caller, bool $blocking = false)
1334+
private function readPipesForOutput(string $caller, bool $blocking = false): void
13271335
{
13281336
if ($this->outputDisabled) {
13291337
throw new LogicException('Output has been disabled.');
@@ -1358,7 +1366,7 @@ private function validateTimeout(?float $timeout): ?float
13581366
* @param bool $blocking Whether to use blocking calls or not
13591367
* @param bool $close Whether to close file handles or not
13601368
*/
1361-
private function readPipes(bool $blocking, bool $close)
1369+
private function readPipes(bool $blocking, bool $close): void
13621370
{
13631371
$result = $this->processPipes->readAndWrite($blocking, $close);
13641372

@@ -1407,7 +1415,7 @@ private function close(): int
14071415
/**
14081416
* Resets data related to the latest run of the process.
14091417
*/
1410-
private function resetProcessData()
1418+
private function resetProcessData(): void
14111419
{
14121420
$this->starttime = null;
14131421
$this->callback = null;
@@ -1528,7 +1536,7 @@ function ($m) use (&$env, $uid) {
15281536
*
15291537
* @throws LogicException if the process has not run
15301538
*/
1531-
private function requireProcessIsStarted(string $functionName)
1539+
private function requireProcessIsStarted(string $functionName): void
15321540
{
15331541
if (!$this->isStarted()) {
15341542
throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
@@ -1540,7 +1548,7 @@ private function requireProcessIsStarted(string $functionName)
15401548
*
15411549
* @throws LogicException if the process is not yet terminated
15421550
*/
1543-
private function requireProcessIsTerminated(string $functionName)
1551+
private function requireProcessIsTerminated(string $functionName): void
15441552
{
15451553
if (!$this->isTerminated()) {
15461554
throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));

0 commit comments

Comments
 (0)