Skip to content

Commit 6b27001

Browse files
wouterjnicolas-grekas
authored andcommitted
Add missing return types to magic methods
1 parent 3e172b3 commit 6b27001

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
@@ -75,7 +75,9 @@ class_exists($class);
7575
if (
7676
$method->getReturnType()
7777
|| str_contains($method->getDocComment(), '@return')
78-
|| str_starts_with($method->getName(), '__')
78+
|| '__construct' === $method->getName()
79+
|| '__destruct' === $method->getName()
80+
|| '__clone' === $method->getName()
7981
|| $method->getDeclaringClass()->getName() !== $class
8082
|| str_contains($method->getDeclaringClass()->getName(), '\\Test\\')
8183
) {

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
@@ -28,6 +28,9 @@ public function __construct(ReverseContainer $reverseContainer)
2828
$this->reverseContainer = $reverseContainer;
2929
}
3030

31+
/**
32+
* @return void
33+
*/
3134
public function __invoke(EarlyExpirationMessage $message)
3235
{
3336
$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)