Skip to content

Commit d7d3f62

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 7423028 + 2d5dff3 commit d7d3f62

File tree

10 files changed

+31
-20
lines changed

10 files changed

+31
-20
lines changed

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
}

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
}

Command/TranslationUpdateCommand.php

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

238-
return;
238+
return null;
239239
}
240240

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

302302
$errorIo->success($resultMessage.'.');
303+
304+
return null;
303305
}
304306

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

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(

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));

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
/**

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));

Templating/GlobalVariables.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,28 @@ 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
/**
7469
* @return Session|null The session
7570
*/
7671
public function getSession()
7772
{
78-
if ($request = $this->getRequest()) {
79-
return $request->getSession();
80-
}
73+
return ($request = $this->getRequest()) ? $request->getSession() : null;
8174
}
8275

8376
/**

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
/**

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ public function testPropertyAccessCache()
9797
$container = $this->createContainerFromFile('property_accessor');
9898

9999
if (!method_exists(PropertyAccessor::class, 'createCache')) {
100-
return $this->assertFalse($container->hasDefinition('cache.property_access'));
100+
$this->assertFalse($container->hasDefinition('cache.property_access'));
101+
102+
return;
101103
}
102104

103105
$cache = $container->getDefinition('cache.property_access');
@@ -110,7 +112,9 @@ public function testPropertyAccessCacheWithDebug()
110112
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
111113

112114
if (!method_exists(PropertyAccessor::class, 'createCache')) {
113-
return $this->assertFalse($container->hasDefinition('cache.property_access'));
115+
$this->assertFalse($container->hasDefinition('cache.property_access'));
116+
117+
return;
114118
}
115119

116120
$cache = $container->getDefinition('cache.property_access');

0 commit comments

Comments
 (0)