Skip to content

Commit aefbc93

Browse files
Merge branch '3.4' into 4.3
* 3.4: Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash
2 parents 2c1f349 + 9672f4c commit aefbc93

File tree

98 files changed

+341
-169
lines changed

Some content is hidden

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

98 files changed

+341
-169
lines changed

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

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

128128
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
129129
}
130+
131+
return null;
130132
}
131133

132134
/**
@@ -146,6 +148,8 @@ public function guessMaxLength($class, $property)
146148
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
147149
}
148150
}
151+
152+
return null;
149153
}
150154

151155
/**
@@ -159,6 +163,8 @@ public function guessPattern($class, $property)
159163
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
160164
}
161165
}
166+
167+
return null;
162168
}
163169

164170
protected function getMetadata($class)
@@ -180,6 +186,8 @@ protected function getMetadata($class)
180186
// not an entity or mapped super class, using Doctrine ORM 2.2
181187
}
182188
}
189+
190+
return null;
183191
}
184192

185193
private static function getRealClass(string $class): string

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

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

161161
return $doctrineChoiceLoader;
162162
}
163+
164+
return null;
163165
};
164166

165167
$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
@@ -184,6 +187,7 @@ public function configureOptions(OptionsResolver $resolver)
184187
}
185188

186189
// Otherwise, an incrementing integer is used as value automatically
190+
return null;
187191
};
188192

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

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
@@ -26,6 +26,8 @@ public static function withClockMock($enable = null)
2626
}
2727

2828
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
29+
30+
return null;
2931
}
3032

3133
public static function time()
@@ -55,6 +57,8 @@ public static function usleep($us)
5557
}
5658

5759
self::$now += $us / 1000000;
60+
61+
return null;
5862
}
5963

6064
public static function microtime($asFloat = false)

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 __sleep()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ public function handleError($type, $msg, $file, $line, $context = array())
341341
$msg = 'Unsilenced deprecation: '.$msg;
342342
}
343343
$this->gatheredDeprecations[] = $msg;
344+
345+
return null;
344346
}
345347

346348
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class SymfonyBlacklistPhpunit {}
168168
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
169169

170170
if ($PHPUNIT_VERSION < 8.0) {
171-
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
171+
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
172172
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
173173
$argv[] = '--do-not-cache-result';
174174
++$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
@@ -296,16 +296,16 @@ private function getMetadata($type, $entity)
296296
return $entity;
297297
}
298298
if ('tests' === $type) {
299-
return;
299+
return null;
300300
}
301301
if ('functions' === $type || 'filters' === $type) {
302302
$cb = $entity->getCallable();
303303
if (null === $cb) {
304-
return;
304+
return null;
305305
}
306306
if (\is_array($cb)) {
307307
if (!method_exists($cb[0], $cb[1])) {
308-
return;
308+
return null;
309309
}
310310
$refl = new \ReflectionMethod($cb[0], $cb[1]);
311311
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
@@ -344,6 +344,8 @@ private function getMetadata($type, $entity)
344344

345345
return $args;
346346
}
347+
348+
return null;
347349
}
348350

349351
private function getPrettyMetadata($type, $entity, $decorated)
@@ -378,6 +380,8 @@ private function getPrettyMetadata($type, $entity, $decorated)
378380
if ('filters' === $type) {
379381
return $meta ? '('.implode(', ', $meta).')' : '';
380382
}
383+
384+
return null;
381385
}
382386

383387
private function findWrongBundleOverrides(): array

0 commit comments

Comments
 (0)