Skip to content

Commit 100f6e9

Browse files
Add return types to internal|final|private methods
1 parent cd575d0 commit 100f6e9

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

CacheWarmer/RouterCacheWarmer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ public function warmUp($cacheDir)
5757
*
5858
* @return bool always true
5959
*/
60-
public function isOptional()
60+
public function isOptional(): bool
6161
{
6262
return true;
6363
}
6464

6565
/**
6666
* {@inheritdoc}
6767
*/
68-
public static function getSubscribedServices()
68+
public static function getSubscribedServices(): array
6969
{
7070
return [
7171
'router' => RouterInterface::class,

Command/ContainerDebugCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,9 @@ protected function validateInput(InputInterface $input)
213213
/**
214214
* Loads the ContainerBuilder from the cache.
215215
*
216-
* @return ContainerBuilder
217-
*
218216
* @throws \LogicException
219217
*/
220-
protected function getContainerBuilder()
218+
protected function getContainerBuilder(): ContainerBuilder
221219
{
222220
if ($this->containerBuilder) {
223221
return $this->containerBuilder;

Console/Descriptor/Descriptor.php

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,12 @@ public function describe(OutputInterface $output, $object, array $options = [])
8484
}
8585
}
8686

87-
/**
88-
* Returns the output.
89-
*
90-
* @return OutputInterface The output
91-
*/
92-
protected function getOutput()
87+
protected function getOutput(): OutputInterface
9388
{
9489
return $this->output;
9590
}
9691

97-
/**
98-
* Writes content to output.
99-
*
100-
* @param string $content
101-
* @param bool $decorated
102-
*/
103-
protected function write($content, $decorated = false)
92+
protected function write(string $content, bool $decorated = false)
10493
{
10594
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
10695
}
@@ -182,10 +171,8 @@ abstract protected function describeCallable($callable, array $options = []);
182171
* Formats a value as string.
183172
*
184173
* @param mixed $value
185-
*
186-
* @return string
187174
*/
188-
protected function formatValue($value)
175+
protected function formatValue($value): string
189176
{
190177
if (\is_object($value)) {
191178
return sprintf('object(%s)', \get_class($value));
@@ -202,10 +189,8 @@ protected function formatValue($value)
202189
* Formats a parameter.
203190
*
204191
* @param mixed $value
205-
*
206-
* @return string
207192
*/
208-
protected function formatParameter($value)
193+
protected function formatParameter($value): string
209194
{
210195
if (\is_bool($value) || \is_array($value) || (null === $value)) {
211196
$jsonString = json_encode($value);
@@ -246,10 +231,8 @@ protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceI
246231

247232
/**
248233
* @param bool $showHidden
249-
*
250-
* @return array
251234
*/
252-
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden)
235+
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden): array
253236
{
254237
$definitions = [];
255238
$tags = $builder->findTags();

Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,7 @@ private function writeData(array $data, array $options)
198198
$this->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n");
199199
}
200200

201-
/**
202-
* @return array
203-
*/
204-
protected function getRouteData(Route $route)
201+
protected function getRouteData(Route $route): array
205202
{
206203
$data = [
207204
'path' => $route->getPath(),

Routing/RedirectableCompiledUrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RedirectableCompiledUrlMatcher extends CompiledUrlMatcher implements Redir
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function redirect($path, $route, $scheme = null)
27+
public function redirect($path, $route, $scheme = null): array
2828
{
2929
return [
3030
'_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',

Test/TestContainer.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Test;
1313

1414
use Symfony\Component\DependencyInjection\Container;
15+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1516
use Symfony\Component\HttpKernel\KernelInterface;
1617

1718
/**
@@ -41,15 +42,15 @@ public function compile()
4142
/**
4243
* {@inheritdoc}
4344
*/
44-
public function isCompiled()
45+
public function isCompiled(): bool
4546
{
4647
return $this->getPublicContainer()->isCompiled();
4748
}
4849

4950
/**
5051
* {@inheritdoc}
5152
*/
52-
public function getParameterBag()
53+
public function getParameterBag(): ParameterBagInterface
5354
{
5455
return $this->getPublicContainer()->getParameterBag();
5556
}
@@ -65,7 +66,7 @@ public function getParameter($name)
6566
/**
6667
* {@inheritdoc}
6768
*/
68-
public function hasParameter($name)
69+
public function hasParameter($name): bool
6970
{
7071
return $this->getPublicContainer()->hasParameter($name);
7172
}
@@ -89,7 +90,7 @@ public function set($id, $service)
8990
/**
9091
* {@inheritdoc}
9192
*/
92-
public function has($id)
93+
public function has($id): bool
9394
{
9495
return $this->getPublicContainer()->has($id) || $this->getPrivateContainer()->has($id);
9596
}
@@ -105,7 +106,7 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE
105106
/**
106107
* {@inheritdoc}
107108
*/
108-
public function initialized($id)
109+
public function initialized($id): bool
109110
{
110111
return $this->getPublicContainer()->initialized($id);
111112
}
@@ -121,15 +122,15 @@ public function reset()
121122
/**
122123
* {@inheritdoc}
123124
*/
124-
public function getServiceIds()
125+
public function getServiceIds(): array
125126
{
126127
return $this->getPublicContainer()->getServiceIds();
127128
}
128129

129130
/**
130131
* {@inheritdoc}
131132
*/
132-
public function getRemovedIds()
133+
public function getRemovedIds(): array
133134
{
134135
return $this->getPublicContainer()->getRemovedIds();
135136
}

0 commit comments

Comments
 (0)