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

Skip to content

Commit 225bf41

Browse files
Merge branch '4.3' into 4.4
* 4.3: cs fix Fix inconsistent return points. [Config] Add handling for ignored keys in ArrayNode::mergeValues. Fix inconsistent return points. [Security/Core] UserInterface::getPassword() can return null [Router] Fix TraceableUrlMatcher behaviour with trailing slash Revert "bug #33092 [DependencyInjection] Improve an exception message (fabpot)"
2 parents a2ef397 + 5ec6ff3 commit 225bf41

File tree

125 files changed

+463
-226
lines changed

Some content is hidden

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

125 files changed

+463
-226
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/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/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
5151
public function convertToDatabaseValue($value, AbstractPlatform $platform)
5252
{
5353
if (null === $value) {
54-
return;
54+
return null;
5555
}
5656
if (!$value instanceof Foo) {
5757
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
@@ -66,7 +66,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
6666
public function convertToPHPValue($value, AbstractPlatform $platform)
6767
{
6868
if (null === $value) {
69-
return;
69+
return null;
7070
}
7171
if (!\is_string($value)) {
7272
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/DeprecationErrorHandler.php

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

106106
$deprecations[] = [error_reporting(), $msg, $file];
107+
108+
return null;
107109
});
108110

109111
register_shutdown_function(function () use ($outputFile, &$deprecations) {
@@ -122,7 +124,7 @@ public function handleError($type, $msg, $file, $line, $context = [])
122124

123125
$deprecation = new Deprecation($msg, debug_backtrace(), $file);
124126
if ($deprecation->isMuted()) {
125-
return;
127+
return null;
126128
}
127129
$group = 'other';
128130

@@ -161,6 +163,8 @@ public function handleError($type, $msg, $file, $line, $context = [])
161163
}
162164

163165
++$this->deprecations[$group.'Count'];
166+
167+
return null;
164168
}
165169

166170
/**

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

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

94-
if (!class_exists($sutFqcn)) {
95-
return;
96-
}
97-
98-
return $sutFqcn;
94+
return class_exists($sutFqcn) ? $sutFqcn : null;
9995
}
10096

10197
public function __sleep()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ public function handleError($type, $msg, $file, $line, $context = array())
320320
$msg = 'Unsilenced deprecation: '.$msg;
321321
}
322322
$this->gatheredDeprecations[] = $msg;
323+
324+
return null;
323325
}
324326

325327
/**

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

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

189189
if ($PHPUNIT_VERSION < 8.0) {
190-
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
190+
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
191191
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
192192
$argv[] = '--do-not-cache-result';
193193
++$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: 2 additions & 3 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
/**

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,16 @@ private function getMetadata(string $type, $entity)
308308
return $entity;
309309
}
310310
if ('tests' === $type) {
311-
return;
311+
return null;
312312
}
313313
if ('functions' === $type || 'filters' === $type) {
314314
$cb = $entity->getCallable();
315315
if (null === $cb) {
316-
return;
316+
return null;
317317
}
318318
if (\is_array($cb)) {
319319
if (!method_exists($cb[0], $cb[1])) {
320-
return;
320+
return null;
321321
}
322322
$refl = new \ReflectionMethod($cb[0], $cb[1]);
323323
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
@@ -356,6 +356,8 @@ private function getMetadata(string $type, $entity)
356356

357357
return $args;
358358
}
359+
360+
return null;
359361
}
360362

361363
private function getPrettyMetadata(string $type, $entity, bool $decorated)
@@ -390,6 +392,8 @@ private function getPrettyMetadata(string $type, $entity, bool $decorated)
390392
if ('filters' === $type) {
391393
return $meta ? '('.implode(', ', $meta).')' : '';
392394
}
395+
396+
return null;
393397
}
394398

395399
private function findWrongBundleOverrides(): array

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getName()
6262
public function dump(Environment $env, $context)
6363
{
6464
if (!$env->isDebug()) {
65-
return;
65+
return null;
6666
}
6767

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

src/Symfony/Bridge/Twig/UndefinedCallableHandler.php

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

7474
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
75+
76+
return true;
7577
}
7678

7779
public static function onUndefinedFunction($name)
@@ -81,6 +83,8 @@ public static function onUndefinedFunction($name)
8183
}
8284

8385
self::onUndefined($name, 'function', self::$functionComponents[$name]);
86+
87+
return true;
8488
}
8589

8690
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
@@ -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/Command/RouterMatchCommand.php

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

114114
return 1;
115115
}
116+
117+
return null;
116118
}
117119
}

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

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

239-
return;
239+
return null;
240240
}
241241

242242
$resultMessage = 'Translation files were successfully updated';
@@ -301,6 +301,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
301301
}
302302

303303
$errorIo->success($resultMessage.'.');
304+
305+
return null;
304306
}
305307

306308
private function filterCatalogue(MessageCatalogue $catalogue, string $domain): MessageCatalogue

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

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

149151
$this->writeData(

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

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

255255
if (!isset($options['id'])) {
256-
return $this->write($output);
256+
$this->write($output);
257+
258+
return;
257259
}
258260

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

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

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

390-
return $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
390+
$this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
391391
}
392392

393393
/**

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

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

102102
if (!$builder) {
103-
return $this->writeDocument($dom);
103+
$this->writeDocument($dom);
104+
105+
return;
104106
}
105107

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

src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,20 @@ public function getToken()
4949
public function getUser()
5050
{
5151
if (!$token = $this->getToken()) {
52-
return;
52+
return null;
5353
}
5454

5555
$user = $token->getUser();
56-
if (!\is_object($user)) {
57-
return;
58-
}
5956

60-
return $user;
57+
return \is_object($user) ? $user : null;
6158
}
6259

6360
/**
6461
* @return Request|null The HTTP request object
6562
*/
6663
public function getRequest()
6764
{
68-
if ($this->container->has('request_stack')) {
69-
return $this->container->get('request_stack')->getCurrentRequest();
70-
}
65+
return $this->container->has('request_stack') ? $this->container->get('request_stack')->getCurrentRequest() : null;
7166
}
7267

7368
/**

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function formatArgs(array $args)
116116
* @param string $file A file path
117117
* @param int $line The selected line number
118118
*
119-
* @return string An HTML string
119+
* @return string|null An HTML string
120120
*/
121121
public function fileExcerpt($file, $line)
122122
{
@@ -144,6 +144,8 @@ public function fileExcerpt($file, $line)
144144

145145
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
146146
}
147+
148+
return null;
147149
}
148150

149151
/**

0 commit comments

Comments
 (0)