Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 365b0d7

Browse files
committed
Fix inconsistent return points.
1 parent ef0119a commit 365b0d7

File tree

130 files changed

+419
-209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+419
-209
lines changed

src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(Cache $cache)
3737
public function fetch($key)
3838
{
3939
if (false === $value = $this->cache->fetch($key)) {
40-
return;
40+
return null;
4141
}
4242

4343
return $value;

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public function guessRequired($class, $property)
118118

119119
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
120120
}
121+
122+
return null;
121123
}
122124

123125
/**
@@ -137,6 +139,8 @@ public function guessMaxLength($class, $property)
137139
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
138140
}
139141
}
142+
143+
return null;
140144
}
141145

142146
/**
@@ -150,6 +154,8 @@ public function guessPattern($class, $property)
150154
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
151155
}
152156
}
157+
158+
return null;
153159
}
154160

155161
protected function getMetadata($class)
@@ -171,5 +177,7 @@ protected function getMetadata($class)
171177
// not an entity or mapped super class, using Doctrine ORM 2.2
172178
}
173179
}
180+
181+
return null;
174182
}
175183
}

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ public function configureOptions(OptionsResolver $resolver)
157157

158158
return $doctrineChoiceLoader;
159159
}
160+
161+
return null;
160162
};
161163

162164
$choiceName = function (Options $options) {
@@ -171,6 +173,7 @@ public function configureOptions(OptionsResolver $resolver)
171173
}
172174

173175
// Otherwise, an incrementing integer is used as name automatically
176+
return null;
174177
};
175178

176179
// The choices are always indexed by ID (see "choices" normalizer
@@ -187,6 +190,7 @@ public function configureOptions(OptionsResolver $resolver)
187190
}
188191

189192
// Otherwise, an incrementing integer is used as value automatically
193+
return null;
190194
};
191195

192196
$emNormalizer = function (Options $options, $em) {

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ private function getMergeSql()
248248
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
249249
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
250250
}
251+
252+
return null;
251253
}
252254

253255
private function getServerVersion()

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public function getProperties($class, array $context = [])
4242
try {
4343
$metadata = $this->classMetadataFactory->getMetadataFor($class);
4444
} catch (MappingException $exception) {
45-
return;
45+
return null;
4646
} catch (OrmMappingException $exception) {
47-
return;
47+
return null;
4848
}
4949

5050
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
@@ -68,9 +68,9 @@ public function getTypes($class, $property, array $context = [])
6868
try {
6969
$metadata = $this->classMetadataFactory->getMetadataFor($class);
7070
} catch (MappingException $exception) {
71-
return;
71+
return null;
7272
} catch (OrmMappingException $exception) {
73-
return;
73+
return null;
7474
}
7575

7676
if ($metadata->hasAssociation($property)) {
@@ -162,6 +162,8 @@ public function getTypes($class, $property, array $context = [])
162162
return $builtinType ? [new Type($builtinType, $nullable)] : null;
163163
}
164164
}
165+
166+
return null;
165167
}
166168

167169
/**
@@ -225,5 +227,7 @@ private function getPhpType($doctrineType)
225227
case DBALType::OBJECT:
226228
return Type::BUILTIN_TYPE_OBJECT;
227229
}
230+
231+
return null;
228232
}
229233
}

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
4747
public function convertToDatabaseValue($value, AbstractPlatform $platform)
4848
{
4949
if (null === $value) {
50-
return;
50+
return null;
5151
}
5252
if (!$value instanceof Foo) {
5353
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
@@ -62,7 +62,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
6262
public function convertToPHPValue($value, AbstractPlatform $platform)
6363
{
6464
if (null === $value) {
65-
return;
65+
return null;
6666
}
6767
if (!\is_string($value)) {
6868
throw ConversionException::conversionFailed($value, self::NAME);

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public static function withClockMock($enable = null)
2525
}
2626

2727
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
28+
29+
return null;
2830
}
2931

3032
public static function time()
@@ -54,6 +56,8 @@ public static function usleep($us)
5456
}
5557

5658
self::$now += $us / 1000000;
59+
60+
return null;
5761
}
5862

5963
public static function microtime($asFloat = false)

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public static function register($mode = 0)
180180
++$ref;
181181
}
182182
++$deprecations[$group.'Count'];
183+
184+
return null;
183185
};
184186
$oldErrorHandler = set_error_handler($deprecationHandler);
185187

@@ -291,6 +293,8 @@ public static function collectDeprecations($outputFile)
291293
return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
292294
}
293295
$deprecations[] = array(error_reporting(), $msg, $file);
296+
297+
return null;
294298
});
295299

296300
register_shutdown_function(function () use ($outputFile, &$deprecations) {

src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ private function findSutFqcn($test)
9595
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
9696
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
9797

98-
if (!class_exists($sutFqcn)) {
99-
return;
100-
}
101-
102-
return $sutFqcn;
98+
return class_exists($sutFqcn) ? $sutFqcn : null;
10399
}
104100

105101
public function __destruct()

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ public function handleError($type, $msg, $file, $line, $context = array())
357357
$msg = 'Unsilenced deprecation: '.$msg;
358358
}
359359
$this->gatheredDeprecations[] = $msg;
360+
361+
return null;
360362
}
361363

362364
/**

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
135135
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
136136

137137
if ($PHPUNIT_VERSION < 8.0) {
138-
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
138+
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
139139
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
140140
$argv[] = '--do-not-cache-result';
141141
++$argc;

src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function generate(string $returnedValueExpression, ?\ReflectionMet
4646
$functionLoader = $functionLoader[0];
4747
}
4848
if (!\is_object($functionLoader)) {
49-
return;
49+
return null;
5050
}
5151
if ($functionLoader instanceof ClassLoader) {
5252
return $functionLoader;
@@ -57,6 +57,8 @@ public static function generate(string $returnedValueExpression, ?\ReflectionMet
5757
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
5858
return $getComposerClassLoader($functionLoader->getClassLoader());
5959
}
60+
61+
return null;
6062
};
6163

6264
$classLoader = null;

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ public function getUser()
8383
}
8484

8585
$user = $token->getUser();
86-
if (\is_object($user)) {
87-
return $user;
88-
}
86+
87+
return \is_object($user) ? $user : null;
8988
}
9089

9190
/**
@@ -113,9 +112,7 @@ public function getSession()
113112
throw new \RuntimeException('The "app.session" variable is not available.');
114113
}
115114

116-
if ($request = $this->getRequest()) {
117-
return $request->getSession();
118-
}
115+
return ($request = $this->getRequest()) ? $request->getSession() : null;
119116
}
120117

121118
/**

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,16 @@ private function getMetadata($type, $entity)
220220
return $entity;
221221
}
222222
if ('tests' === $type) {
223-
return;
223+
return null;
224224
}
225225
if ('functions' === $type || 'filters' === $type) {
226226
$cb = $entity->getCallable();
227227
if (null === $cb) {
228-
return;
228+
return null;
229229
}
230230
if (\is_array($cb)) {
231231
if (!method_exists($cb[0], $cb[1])) {
232-
return;
232+
return null;
233233
}
234234
$refl = new \ReflectionMethod($cb[0], $cb[1]);
235235
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
@@ -268,6 +268,8 @@ private function getMetadata($type, $entity)
268268

269269
return $args;
270270
}
271+
272+
return null;
271273
}
272274

273275
private function getPrettyMetadata($type, $entity, $decorated)
@@ -302,5 +304,7 @@ private function getPrettyMetadata($type, $entity, $decorated)
302304
if ('filters' === $type) {
303305
return $meta ? '('.implode(', ', $meta).')' : '';
304306
}
307+
308+
return null;
305309
}
306310
}

src/Symfony/Bridge/Twig/Extension/DumpExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getName()
5555
public function dump(Environment $env, $context)
5656
{
5757
if (!$env->isDebug()) {
58-
return;
58+
return null;
5959
}
6060

6161
if (2 === \func_num_args()) {

src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function getReadDomainFromArguments(Node $arguments, $index)
115115
} elseif ($arguments->hasNode($index)) {
116116
$argument = $arguments->getNode($index);
117117
} else {
118-
return;
118+
return null;
119119
}
120120

121121
return $this->getReadDomainFromNode($argument);

src/Symfony/Bridge/Twig/UndefinedCallableHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public static function onUndefinedFilter($name)
7171
}
7272

7373
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
74+
75+
return true;
7476
}
7577

7678
public static function onUndefinedFunction($name)
@@ -80,6 +82,8 @@ public static function onUndefinedFunction($name)
8082
}
8183

8284
self::onUndefined($name, 'function', self::$functionComponents[$name]);
85+
86+
return true;
8387
}
8488

8589
private static function onUndefined($name, $type, $component)

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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)

0 commit comments

Comments
 (0)