Skip to content

Commit 23faee4

Browse files
[4.4] Add return types on internal|final|private methods (bis)
1 parent 7eb5fee commit 23faee4

File tree

21 files changed

+77
-74
lines changed

21 files changed

+77
-74
lines changed

src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function attach(string $file, string $name = null, string $contentType =
6363
/**
6464
* @return $this
6565
*/
66-
public function setSubject(string $subject)
66+
public function setSubject(string $subject): self
6767
{
6868
$this->message->subject($subject);
6969

@@ -78,7 +78,7 @@ public function getSubject(): ?string
7878
/**
7979
* @return $this
8080
*/
81-
public function setReturnPath(string $address)
81+
public function setReturnPath(string $address): self
8282
{
8383
$this->message->returnPath($address);
8484

@@ -93,7 +93,7 @@ public function getReturnPath(): string
9393
/**
9494
* @return $this
9595
*/
96-
public function addFrom(string $address, string $name = null)
96+
public function addFrom(string $address, string $name = null): self
9797
{
9898
$this->message->addFrom($name ? new NamedAddress($address, $name) : new Address($address));
9999

@@ -111,7 +111,7 @@ public function getFrom(): array
111111
/**
112112
* @return $this
113113
*/
114-
public function addReplyTo(string $address)
114+
public function addReplyTo(string $address): self
115115
{
116116
$this->message->addReplyTo($address);
117117

@@ -129,7 +129,7 @@ public function getReplyTo(): array
129129
/**
130130
* @return $this
131131
*/
132-
public function addTo(string $address, string $name = null)
132+
public function addTo(string $address, string $name = null): self
133133
{
134134
$this->message->addTo($name ? new NamedAddress($address, $name) : new Address($address));
135135

@@ -147,7 +147,7 @@ public function getTo(): array
147147
/**
148148
* @return $this
149149
*/
150-
public function addCc(string $address, string $name = null)
150+
public function addCc(string $address, string $name = null): self
151151
{
152152
$this->message->addCc($name ? new NamedAddress($address, $name) : new Address($address));
153153

@@ -165,7 +165,7 @@ public function getCc(): array
165165
/**
166166
* @return $this
167167
*/
168-
public function addBcc(string $address, string $name = null)
168+
public function addBcc(string $address, string $name = null): self
169169
{
170170
$this->message->addBcc($name ? new NamedAddress($address, $name) : new Address($address));
171171

@@ -183,7 +183,7 @@ public function getBcc(): array
183183
/**
184184
* @return $this
185185
*/
186-
public function setPriority(int $priority)
186+
public function setPriority(int $priority): self
187187
{
188188
$this->message->setPriority($priority);
189189

src/Symfony/Component/Cache/CacheItem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function isHit()
6767
*
6868
* @return $this
6969
*/
70-
public function set($value)
70+
public function set($value): self
7171
{
7272
$this->value = $value;
7373

@@ -79,7 +79,7 @@ public function set($value)
7979
*
8080
* @return $this
8181
*/
82-
public function expiresAt($expiration)
82+
public function expiresAt($expiration): self
8383
{
8484
if (null === $expiration) {
8585
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
@@ -97,7 +97,7 @@ public function expiresAt($expiration)
9797
*
9898
* @return $this
9999
*/
100-
public function expiresAfter($time)
100+
public function expiresAfter($time): self
101101
{
102102
if (null === $time) {
103103
$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): self
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(): self
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): self
4545
{
4646
if ($on && !$this->hasFlag($flag)) {
4747
$this->flags += $flag;

src/Symfony/Component/DependencyInjection/ChildDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ public function replaceArgument($index, $value)
109109
/**
110110
* @internal
111111
*/
112-
public function setAutoconfigured($autoconfigured)
112+
public function setAutoconfigured($autoconfigured): self
113113
{
114114
throw new BadMethodCallException('A ChildDefinition cannot be autoconfigured.');
115115
}
116116

117117
/**
118118
* @internal
119119
*/
120-
public function setInstanceofConditionals(array $instanceof)
120+
public function setInstanceofConditionals(array $instanceof): self
121121
{
122122
throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.');
123123
}

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

Lines changed: 2 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
}
@@ -167,7 +167,7 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface
167167
/**
168168
* {@inheritdoc}
169169
*/
170-
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
170+
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): self
171171
{
172172
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));
173173
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ final class ScalarFactory
77
/**
88
* @return string
99
*/
10-
public static function getSomeValue()
10+
public static function getSomeValue(): string
1111
{
1212
return 'some value';
1313
}

src/Symfony/Component/Form/Util/OptionsResolverWrapper.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class OptionsResolverWrapper extends OptionsResolver
2424
{
2525
private $undefined = [];
2626

27-
public function setNormalizer($option, \Closure $normalizer)
27+
/**
28+
* @return $this
29+
*/
30+
public function setNormalizer($option, \Closure $normalizer): self
2831
{
2932
try {
3033
parent::setNormalizer($option, $normalizer);
@@ -35,7 +38,10 @@ public function setNormalizer($option, \Closure $normalizer)
3538
return $this;
3639
}
3740

38-
public function setAllowedValues($option, $allowedValues)
41+
/**
42+
* @return $this
43+
*/
44+
public function setAllowedValues($option, $allowedValues): self
3945
{
4046
try {
4147
parent::setAllowedValues($option, $allowedValues);
@@ -46,7 +52,10 @@ public function setAllowedValues($option, $allowedValues)
4652
return $this;
4753
}
4854

49-
public function addAllowedValues($option, $allowedValues)
55+
/**
56+
* @return $this
57+
*/
58+
public function addAllowedValues($option, $allowedValues): self
5059
{
5160
try {
5261
parent::addAllowedValues($option, $allowedValues);
@@ -57,7 +66,10 @@ public function addAllowedValues($option, $allowedValues)
5766
return $this;
5867
}
5968

60-
public function setAllowedTypes($option, $allowedTypes)
69+
/**
70+
* @return $this
71+
*/
72+
public function setAllowedTypes($option, $allowedTypes): self
6173
{
6274
try {
6375
parent::setAllowedTypes($option, $allowedTypes);
@@ -68,7 +80,10 @@ public function setAllowedTypes($option, $allowedTypes)
6880
return $this;
6981
}
7082

71-
public function addAllowedTypes($option, $allowedTypes)
83+
/**
84+
* @return $this
85+
*/
86+
public function addAllowedTypes($option, $allowedTypes): self
7287
{
7388
try {
7489
parent::addAllowedTypes($option, $allowedTypes);
@@ -84,7 +99,7 @@ public function resolve(array $options = []): array
8499
throw new AccessException('Resolve options is not supported.');
85100
}
86101

87-
public function getUndefinedOptions()
102+
public function getUndefinedOptions(): array
88103
{
89104
return array_keys($this->undefined);
90105
}

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function supports(Request $request, ArgumentMetadata $argument)
5858
/**
5959
* {@inheritdoc}
6060
*/
61-
public function resolve(Request $request, ArgumentMetadata $argument)
61+
public function resolve(Request $request, ArgumentMetadata $argument): iterable
6262
{
6363
if (\is_array($controller = $request->attributes->get('_controller'))) {
6464
$controller = $controller[0].'::'.$controller[1];

0 commit comments

Comments
 (0)