Skip to content

Commit c4c24b8

Browse files
[5.0] Add return types on internal|final|private methods
1 parent 4036357 commit c4c24b8

File tree

30 files changed

+82
-80
lines changed

30 files changed

+82
-80
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ protected function send($content, array $records): void
6363

6464
/**
6565
* {@inheritdoc}
66-
*
67-
* @return void
6866
*/
69-
public function reset()
67+
public function reset(): void
7068
{
7169
$this->flushMemorySpool();
7270
}

src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function has($id): bool
9898
/**
9999
* {@inheritdoc}
100100
*/
101-
public function get($id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1)
101+
public function get($id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1): ?object
102102
{
103103
return $this->getPrivateContainer()->has($id) ? $this->getPrivateContainer()->get($id) : $this->getPublicContainer()->get($id, $invalidBehavior);
104104
}

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ public function testGetUserWithEmptyContainer()
159159

160160
/**
161161
* @param $token
162-
*
163-
* @return Container
164162
*/
165-
private function getContainerWithTokenStorage($token = null)
163+
private function getContainerWithTokenStorage($token = null): Container
166164
{
167165
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage')->getMock();
168166
$tokenStorage

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,7 @@ private function checkResultCode($result)
316316
throw new CacheException(sprintf('MemcachedAdapter client error: %s.', strtolower($this->client->getResultMessage())));
317317
}
318318

319-
/**
320-
* @return \Memcached
321-
*/
322-
private function getClient()
319+
private function getClient(): \Memcached
323320
{
324321
if ($this->client) {
325322
return $this->client;

src/Symfony/Component/Cache/CacheItem.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function isHit(): bool
6161
/**
6262
* {@inheritdoc}
6363
*
64-
* @return static
64+
* @return $this
6565
*/
66-
public function set($value)
66+
public function set($value): object
6767
{
6868
$this->value = $value;
6969

@@ -73,9 +73,9 @@ public function set($value)
7373
/**
7474
* {@inheritdoc}
7575
*
76-
* @return static
76+
* @return $this
7777
*/
78-
public function expiresAt($expiration)
78+
public function expiresAt($expiration): object
7979
{
8080
if (null === $expiration) {
8181
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
@@ -91,9 +91,9 @@ public function expiresAt($expiration)
9191
/**
9292
* {@inheritdoc}
9393
*
94-
* @return static
94+
* @return $this
9595
*/
96-
public function expiresAfter($time)
96+
public function expiresAfter($time): object
9797
{
9898
if (null === $time) {
9999
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;

src/Symfony/Component/CssSelector/Parser/TokenStream.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TokenStream
5656
*
5757
* @return $this
5858
*/
59-
public function push(Token $token)
59+
public function push(Token $token): object
6060
{
6161
$this->tokens[] = $token;
6262

@@ -68,7 +68,7 @@ public function push(Token $token)
6868
*
6969
* @return $this
7070
*/
71-
public function freeze()
71+
public function freeze(): object
7272
{
7373
return $this;
7474
}

src/Symfony/Component/CssSelector/XPath/Extension/ExtensionInterface.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,38 @@ interface ExtensionInterface
3030
*
3131
* @return callable[]
3232
*/
33-
public function getNodeTranslators();
33+
public function getNodeTranslators(): array;
3434

3535
/**
3636
* Returns combination translators.
3737
*
3838
* @return callable[]
3939
*/
40-
public function getCombinationTranslators();
40+
public function getCombinationTranslators(): array;
4141

4242
/**
4343
* Returns function translators.
4444
*
4545
* @return callable[]
4646
*/
47-
public function getFunctionTranslators();
47+
public function getFunctionTranslators(): array;
4848

4949
/**
5050
* Returns pseudo-class translators.
5151
*
5252
* @return callable[]
5353
*/
54-
public function getPseudoClassTranslators();
54+
public function getPseudoClassTranslators(): array;
5555

5656
/**
5757
* Returns attribute operation translators.
5858
*
5959
* @return callable[]
6060
*/
61-
public function getAttributeMatchingTranslators();
61+
public function getAttributeMatchingTranslators(): array;
6262

6363
/**
6464
* Returns extension name.
65-
*
66-
* @return string
6765
*/
68-
public function getName();
66+
public function getName(): string;
6967
}

src/Symfony/Component/CssSelector/XPath/Extension/NodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(int $flags = 0)
4141
/**
4242
* @return $this
4343
*/
44-
public function setFlag(int $flag, bool $on)
44+
public function setFlag(int $flag, bool $on): object
4545
{
4646
if ($on && !$this->hasFlag($flag)) {
4747
$this->flags += $flag;

src/Symfony/Component/DependencyInjection/ChildDefinition.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,20 @@ public function replaceArgument($index, $value)
108108

109109
/**
110110
* @internal
111+
*
112+
* @return $this
111113
*/
112-
public function setAutoconfigured(bool $autoconfigured)
114+
public function setAutoconfigured(bool $autoconfigured): object
113115
{
114116
throw new BadMethodCallException('A ChildDefinition cannot be autoconfigured.');
115117
}
116118

117119
/**
118120
* @internal
121+
*
122+
* @return $this
119123
*/
120-
public function setInstanceofConditionals(array $instanceof)
124+
public function setInstanceofConditionals(array $instanceof): object
121125
{
122126
throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.');
123127
}

src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co
137137
/**
138138
* {@inheritdoc}
139139
*/
140-
public function getEnvPlaceholders()
140+
public function getEnvPlaceholders(): array
141141
{
142142
return null !== $this->processedEnvPlaceholders ? $this->processedEnvPlaceholders : parent::getEnvPlaceholders();
143143
}
@@ -166,8 +166,10 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface
166166

167167
/**
168168
* {@inheritdoc}
169+
*
170+
* @return $this
169171
*/
170-
public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
172+
public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): object
171173
{
172174
throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', \get_class($pass), $this->extensionClass));
173175
}

0 commit comments

Comments
 (0)