Skip to content

Commit 7868846

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent 07e9a7e commit 7868846

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

Compiler/AnalyzeServiceReferencesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function getDefinitionId($id)
156156
}
157157

158158
if (!$this->container->hasDefinition($id)) {
159-
return;
159+
return null;
160160
}
161161

162162
return $this->container->normalizeId($id);

Compiler/CheckArgumentsValidityPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,7 @@ protected function processValue($value, $isRoot = false)
8181
}
8282
}
8383
}
84+
85+
return null;
8486
}
8587
}

ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public function addClassResource(\ReflectionClass $class)
354354
public function getReflectionClass($class, $throw = true)
355355
{
356356
if (!$class = $this->getParameterBag()->resolveValue($class)) {
357-
return;
357+
return null;
358358
}
359359

360360
if (isset(self::$internalTypes[$class])) {
@@ -621,7 +621,7 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_
621621
$definition = $this->getDefinition($id);
622622
} catch (ServiceNotFoundException $e) {
623623
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
624-
return;
624+
return null;
625625
}
626626

627627
throw $e;

EnvVarProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
6565

6666
if (false !== $i || 'string' !== $prefix) {
6767
if (null === $env = $getEnv($name)) {
68-
return;
68+
return null;
6969
}
7070
} elseif (isset($_ENV[$name])) {
7171
$env = $_ENV[$name];
@@ -77,7 +77,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
7777
}
7878

7979
if (null === $env = $this->container->getParameter("env($name)")) {
80-
return;
80+
return null;
8181
}
8282
}
8383

Extension/Extension.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ public function getConfiguration(array $config, ContainerBuilder $container)
8484
$class = $container->getReflectionClass($class);
8585
$constructor = $class ? $class->getConstructor() : null;
8686

87-
if ($class && (!$constructor || !$constructor->getNumberOfRequiredParameters())) {
88-
return $class->newInstance();
89-
}
87+
return $class && (!$constructor || !$constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null;
9088
}
9189

90+
/**
91+
* @return array
92+
*/
9293
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
9394
{
9495
$processor = new Processor();

LazyProxy/ProxyHelper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa
5858
if ('self' === $lcName) {
5959
return $prefix.$r->getDeclaringClass()->name;
6060
}
61-
if ($parent = $r->getDeclaringClass()->getParentClass()) {
62-
return $prefix.$parent->name;
63-
}
61+
62+
return ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
6463
}
6564
}

0 commit comments

Comments
 (0)