8000 Merge branch '4.4' · symfony/symfony@322da9d · GitHub
[go: up one dir, main page]

Skip to content

Commit 322da9d

Browse files
Merge branch '4.4'
* 4.4: 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 cs fix cs fix Fix missing exporter in PHPUnit constraint poylfill added `Process::getLastOutputTime()` method [Router] Fix TraceableUrlMatcher behaviour with trailing slash [HttpKernel] Remove outdated docblock comment Fix handling for session parameters Revert "bug #33092 [DependencyInjection] Improve an exception message (fabpot)"
2 parents c12e9f9 + 225bf41 commit 322da9d

File tree

119 files changed

+437
-213
lines changed

Some content is hidden

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

119 files changed

+437
-213
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(string $class, string $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(string $class, string $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(string $class, string $property)
159163
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
160164
}
161165
}
166+
167+
return null;
162168
}
163169

164170
protected function getMetadata(string $class)
@@ -180,6 +186,8 @@ protected function getMetadata(string $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
@@ -156,6 +156,8 @@ public function configureOptions(OptionsResolver $resolver)
156156

157157
return $doctrineChoiceLoader;
158158
}
159+
160+
return null;
159161
};
160162

161163
$choiceName = function (Options $options) {
@@ -167,6 +169,7 @@ public function configureOptions(OptionsResolver $resolver)
167169
}
168170

169171
// Otherwise, an incrementing integer is used as name automatically
172+
return null;
170173
};
171174

172175
// The choices are always indexed by ID (see "choices" normalizer
@@ -180,6 +183,7 @@ public function configureOptions(OptionsResolver $resolver)
180183
}
181184

182185
// Otherwise, an incrementing integer is used as value automatically
186+
return null;
183187
};
184188

185189
$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
@@ -157,6 +157,8 @@ public function getTypes(string $class, string $property, array $context = [])
157157
return $builtinType ? [new Type($builtinType, $nullable)] : null;
158158
}
159159
}
160+
161+
return null;
160162
}
161163

162164
/**

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
@@ -99,6 +99,8 @@ public static function collectDeprecations($outputFile)
9999
}
100100

101101
$deprecations[] = [error_reporting(), $msg, $file];
102+
103+
return null;
102104
});
103105

104106
register_shutdown_function(function () use ($outputFile, &$deprecations) {
@@ -117,7 +119,7 @@ public function handleError($type, $msg, $file, $line, $context = [])
117119

118120
$deprecation = new Deprecation($msg, debug_backtrace(), $file);
119121
if ($deprecation->isMuted()) {
120-
return;
122+
return null;
121123
}
122124
$group = 'other';
123125

@@ -156,6 +158,8 @@ public function handleError($type, $msg, $file, $line, $context = [])
156158
}
157159

158160
++$this->deprecations[$group.'Count'];
161+
162+
return null;
159163
}
160164

161165
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ protected function additionalFailureDescription($other)
4949
*/
5050
protected function exporter()
5151
{
52+
if (null === $this->exporter) {
53+
$this->exporter = new Exporter();
54+
}
55+
5256
return $this->exporter;
5357
}
5458

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
@@ -47,14 +47,16 @@ public static function generate(string $returnedValueExpression, ?\ReflectionMet
4747
$functionLoader = $functionLoader[0];
4848
}
4949
if (!\is_object($functionLoader)) {
50-
return;
50+
return null;
5151
}
5252
if ($functionLoader instanceof ClassLoader) {
5353
return $functionLoader;
5454
}
5555
if ($functionLoader instanceof DebugClassLoader) {
5656
return $getComposerClassLoader($functionLoader->getClassLoader());
5757
}
58+
59+
return null;
5860
};
5961

6062
$classLoader = null;

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use ProxyManager\Version;
1615
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1716
use Symfony\Component\DependencyInjection\Definition;
1817
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;

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
@@ -294,16 +294,16 @@ private function getMetadata(string $type, $entity)
294294
return $entity;
295295
}
296296
if ('tests' === $type) {
297-
return;
297+
return null;
298298
}
299299
if ('functions' === $type || 'filters' === $type) {
300300
$cb = $entity->getCallable();
301301
if (null === $cb) {
302-
return;
302+
return null;
303303
}
304304
if (\is_array($cb)) {
305305
if (!method_exists($cb[0], $cb[1])) {
306-
return;
306+
return null;
307307
}
308308
$refl = new \ReflectionMethod($cb[0], $cb[1]);
309309
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
@@ -342,6 +342,8 @@ private function getMetadata(string $type, $entity)
342342

343343
return $args;
344344
}
345+
346+
return null;
345347
}
346348

347349
private function getPrettyMetadata(string $type, $entity, bool $decorated)
@@ -376,6 +378,8 @@ private function getPrettyMetadata(string $type, $entity, bool $decorated)
376378
if ('filters' === $type) {
377379
return $meta ? '('.implode(', ', $meta).')' : '';
378380
}
381+
382+
return null;
379383
}
380384

381385
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, array $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(string $name)
7272
}
7373

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

7779
public static function onUndefinedFunction(string $name)
@@ -81,6 +83,8 @@ public static function onUndefinedFunction(string $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
@@ -198,7 +198,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
198198
if (!\count($operation->getDomains())) {
199199
$errorIo->warning('No translation messages were found.');
200200

201-
return;
201+
return null;
202202
}
203203

204204
$resultMessage = 'Translation files were successfully updated';
@@ -263,6 +263,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
263263
}
264264

265265
$errorIo->success($resultMessage.'.');
266+
267+
return null;
266268
}
267269

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ abstract protected function describeEventDispatcherListeners(EventDispatcherInte
171171
/**
172172
* Describes a callable.
173173
*
174-
* @param callable $callable
174+
* @param mixed $callable
17 B41A 5175
*/
176176
abstract protected function describeCallable($callable, array $options = []);
177177

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/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
849849
// session storage
850850
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
851851
$options = ['cache_limiter' => '0'];
852-
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor'] as $key) {
852+
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'sid_length', 'sid_bits_per_character'] as $key) {
853853
if (isset($config[$key])) {
854854
$options[$key] = $config[$key];
855855
}

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
'gc_maxlifetime' => 90000,
3838
'gc_divisor' => 108,
3939
'gc_probability' => 1,
40+
'sid_length' => 22,
41+
'sid_bits_per_character' => 4,
4042
'save_path' => '/path/to/sessions',
4143
],
4244
'assets' => [

0 commit comments

Comments
 (0)
0