Skip to content

Commit 7147751

Browse files
feature #50842 Add missing return types to magic methods (wouterj)
This PR was merged into the 6.4 branch. Discussion ---------- Add missing return types to magic methods | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - I promise, these 72 methods really are the last methods that did not have a return type already 🙃 Commits ------- 6b27001 Add missing return types to magic methods
2 parents 9d68d28 + 6b27001 commit 7147751

Some content is hidden

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

48 files changed

+470
-49
lines changed

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

Lines changed: 360 additions & 30 deletions
Large diffs are not rendered by default.

.github/patch-types.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ class_exists($class);
7676
if (
7777
$method->getReturnType()
7878
|| str_contains($method->getDocComment(), '@return')
79-
|| str_starts_with($method->getName(), '__')
79+
|| '__construct' === $method->getName()
80+
|| '__destruct' === $method->getName()
81+
|| '__clone' === $method->getName()
8082
|| $method->getDeclaringClass()->getName() !== $class
8183
|| str_contains($method->getDeclaringClass()->getName(), '\\Test\\')
8284
) {

src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ public function __sleep(): array
154154
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
155155
}
156156

157+
/**
158+
* @return void
159+
*/
157160
public function __wakeup()
158161
{
159162
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);

src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ final class WrappedListener
2424
{
2525
use TraceableListenerTrait;
2626

27+
/**
28+
* @param callable(RequestEvent):void $listener
29+
*/
2730
public function __construct(callable $listener)
2831
{
2932
$this->listener = $listener;
3033
}
3134

32-
public function __invoke(RequestEvent $event)
35+
public function __invoke(RequestEvent $event): void
3336
{
3437
$startTime = microtime(true);
3538
($this->listener)($event);

src/Symfony/Bundle/SecurityBundle/Security/LazyFirewallContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getListeners(): iterable
3939
return [$this];
4040
}
4141

42-
public function __invoke(RequestEvent $event)
42+
public function __invoke(RequestEvent $event): void
4343
{
4444
$listeners = [];
4545
$request = $event->getRequest();

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ public function __sleep(): array
295295
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
296296
}
297297

298+
/**
299+
* @return void
300+
*/
298301
public function __wakeup()
299302
{
300303
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);

src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function __construct(MessageBusInterface $bus, ReverseContainer $reverseC
3434
$this->callbackWrapper = null === $callbackWrapper ? null : $callbackWrapper(...);
3535
}
3636

37+
/**
38+
* @return mixed
39+
*/
3740
public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, LoggerInterface $logger = null)
3841
{
3942
if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) {

src/Symfony/Component/Cache/Messenger/EarlyExpirationHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public function __construct(ReverseContainer $reverseContainer)
2929
$this->reverseContainer = $reverseContainer;
3030
}
3131

32+
/**
33+
* @return void
34+
*/
3235
public function __invoke(EarlyExpirationMessage $message)
3336
{
3437
$item = $message->getItem();

src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ public function __sleep(): array
283283
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
284284
}
285285

286+
/**
287+
* @return void
288+
*/
286289
public function __wakeup()
287290
{
288291
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);

src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ public function __sleep(): array
171171
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
172172
}
173173

174+
/**
175+
* @return void
176+
*/
174177
public function __wakeup()
175178
{
176179
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy