Skip to content

Commit c26c535

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent c1e0c1b commit c26c535

File tree

25 files changed

+62
-48
lines changed

25 files changed

+62
-48
lines changed

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ public function getTypes($class, $property, array $context = [])
168168
return $builtinType ? [new Type($builtinType, $nullable)] : null;
169169
}
170170
}
171+
172+
return null;
171173
}
172174

173175
/**

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public static function collectDeprecations($outputFile)
107107
}
108108

109109
$deprecations[] = [error_reporting(), $msg, $file];
110+
111+
return null;
110112
});
111113

112114
register_shutdown_function(function () use ($outputFile, &$deprecations) {
@@ -125,7 +127,7 @@ public function handleError($type, $msg, $file, $line, $context = [])
125127

126128
$deprecation = new Deprecation($msg, debug_backtrace(), $file);
127129
if ($deprecation->isMuted()) {
128-
return;
130+
return null;
129131
}
130132
$group = 'other';
131133

@@ -164,6 +166,8 @@ public function handleError($type, $msg, $file, $line, $context = [])
164166
}
165167

166168
++$this->deprecations[$group.'Count'];
169+
170+
return null;
167171
}
168172

169173
/**

src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
145145
}
146146

147147
$io->newLine();
148+
149+
return null;
148150
}
149151

150152
private function getFileLink(string $class): string

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ public function getName()
3939

4040
public function __call($method, $arguments = [])
4141
{
42-
if (null !== $this->stopwatch) {
43-
if (method_exists($this->stopwatch, $method)) {
44-
return $this->stopwatch->{$method}(...$arguments);
45-
}
42+
if (null === $this->stopwatch) {
43+
return null;
44+
}
4645

47-
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
46+
if (method_exists($this->stopwatch, $method)) {
47+
return $this->stopwatch->{$method}(...$arguments);
4848
}
49+
50+
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
4951
}
5052
}

src/Symfony/Bundle/WebServerBundle/WebServerConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function getDisplayAddress()
117117
return gethostbyname($localHostname).':'.$this->port;
118118
}
119119

120-
private function findFrontController($documentRoot, $env)
120+
private function findFrontController(string $documentRoot, string $env): ?string
121121
{
122122
$fileNames = $this->getFrontControllerFileNames($env);
123123

@@ -126,14 +126,16 @@ private function findFrontController($documentRoot, $env)
126126
return $fileName;
127127
}
128128
}
129+
130+
return null;
129131
}
130132

131-
private function getFrontControllerFileNames($env)
133+
private function getFrontControllerFileNames(string $env): array
132134
{
133135
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
134136
}
135137

136-
private function findBestPort()
138+
private function findBestPort(): int
137139
{
138140
$port = 8000;
139141
while (false !== $fp = @fsockopen($this->hostname, $port, $errno, $errstr, 1)) {

src/Symfony/Component/Cache/Traits/ArrayTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private function freeze($value, $key)
131131
$message = sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage());
132132
CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]);
133133

134-
return;
134+
return null;
135135
}
136136
// Keep value serialized if it contains any objects or any internal references
137137
if ('C' === $serialized[0] || 'O' === $serialized[0] || preg_match('/;[OCRr]:[1-9]/', $serialized)) {

src/Symfony/Component/Console/Output/ConsoleSectionOutput.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public function addContent(string $input)
9595
protected function doWrite($message, $newline)
9696
{
9797
if (!$this->isDecorated()) {
98-
return parent::doWrite($message, $newline);
98+
parent::doWrite($message, $newline);
99+
100+
return;
99101
}
100102

101103
$erasedContent = $this->popStreamContentUntilCurrentSection();

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,9 @@ public function handleException($exception, array $error = null)
576576
$this->exceptionHandler = null;
577577
try {
578578
if (null !== $exceptionHandler) {
579-
return $exceptionHandler($exception);
579+
$exceptionHandler($exception);
580+
581+
return;
580582
}
581583
$handlerException = $handlerException ?: $exception;
582584
} catch (\Throwable $handlerException) {

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ private function make(string $id, int $invalidBehavior)
276276

277277
throw new ServiceNotFoundException($id, null, null, $alternatives);
278278
}
279+
280+
return null;
279281
}
280282

281283
/**

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_
592592
$definition = $this->getDefinition($id);
593593
} catch (ServiceNotFoundException $e) {
594594
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $invalidBehavior) {
595-
return;
595+
return null;
596596
}
597597

598598
throw $e;

0 commit comments

Comments
 (0)