Skip to content

Commit beaeac2

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent bceeb3b commit beaeac2

15 files changed

+48
-36
lines changed

Command/ConfigDumpReferenceCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8686
'For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>config:dump-reference FrameworkBundle profiler.matcher</comment> to dump the <comment>framework.profiler.matcher</comment> configuration)',
8787
]);
8888

89-
return;
89+
return null;
9090
}
9191

9292
$extension = $this->findExtension($name);
@@ -129,5 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
129129
}
130130

131131
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
132+
133+
return null;
132134
}
133135
}

Command/DebugAutowiringCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9393
}
9494

9595
$io->table([], $tableRows);
96+
97+
return null;
9698
}
9799
}

Command/RouterDebugCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,13 @@ private function convertController(Route $route)
154154
}
155155
}
156156

157+
/**
158+
* @return callable|null
159+
*/
157160
private function extractCallable(Route $route)
158161
{
159162
if (!$route->hasDefault('_controller')) {
160-
return;
163+
return null;
161164
}
162165

163166
$controller = $route->getDefault('_controller');
@@ -178,5 +181,7 @@ private function extractCallable(Route $route)
178181
return $controller;
179182
} catch (\InvalidArgumentException $e) {
180183
}
184+
185+
return null;
181186
}
182187
}

Command/RouterMatchCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
149149

150150
return 1;
151151
}
152+
153+
return null;
152154
}
153155
}

Command/TranslationUpdateCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
242242
if (!\count($operation->getDomains())) {
243243
$errorIo->warning('No translation messages were found.');
244244

245-
return;
245+
return null;
246246
}
247247

248248
$resultMessage = 'Translation files were successfully updated';
@@ -307,6 +307,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
307307
}
308308

309309
$errorIo->success($resultMessage.'.');
310+
311+
return null;
310312
}
311313

312314
private function filterCatalogue(MessageCatalogue $catalogue, $domain)

Console/Descriptor/JsonDescriptor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ protected function describeContainerDefinition(Definition $definition, array $op
142142
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
143143
{
144144
if (!$builder) {
145-
return $this->writeData($this->getContainerAliasData($alias), $options);
145+
$this->writeData($this->getContainerAliasData($alias), $options);
146+
147+
return;
146148
}
147149

148150
$this->writeData(

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
249249
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
250250

251251
if (!isset($options['id'])) {
252-
return $this->write($output);
252+
$this->write($output);
253+
254+
return;
253255
}
254256

255257
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));

Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
369369
return;
370370
}
371371

372-
return $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
372+
$this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
373373
}
374374

375375
/**

Console/Descriptor/XmlDescriptor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
9898
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
9999

100100
if (!$builder) {
101-
return $this->writeDocument($dom);
101+
$this->writeDocument($dom);
102+
103+
return;
102104
}
103105

104106
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));

EventListener/SessionListener.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ public function __construct(ContainerInterface $container)
3434

3535
protected function getSession()
3636
{
37-
if (!$this->container->has('session')) {
38-
return;
39-
}
40-
41-
return $this->container->get('session');
37+
return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
4238
}
4339
}

0 commit comments

Comments
 (0)