diff --git a/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php b/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php
index 1bc22ce7aa632..3b028ab7a4203 100644
--- a/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php
+++ b/src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php
@@ -37,7 +37,7 @@ public function __construct(Cache $cache)
public function fetch($key)
{
if (false === $value = $this->cache->fetch($key)) {
- return;
+ return null;
}
return $value;
diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
index 6776b5db917f7..1df396d367d84 100644
--- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -118,6 +118,8 @@ public function guessRequired($class, $property)
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
}
+
+ return null;
}
/**
@@ -137,6 +139,8 @@ public function guessMaxLength($class, $property)
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
}
+
+ return null;
}
/**
@@ -150,6 +154,8 @@ public function guessPattern($class, $property)
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
}
+
+ return null;
}
protected function getMetadata($class)
@@ -171,5 +177,7 @@ protected function getMetadata($class)
// not an entity or mapped super class, using Doctrine ORM 2.2
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
index 0e726852f2bec..60caab8ba68fa 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -157,6 +157,8 @@ public function configureOptions(OptionsResolver $resolver)
return $doctrineChoiceLoader;
}
+
+ return null;
};
$choiceName = function (Options $options) {
@@ -171,6 +173,7 @@ public function configureOptions(OptionsResolver $resolver)
}
// Otherwise, an incrementing integer is used as name automatically
+ return null;
};
// The choices are always indexed by ID (see "choices" normalizer
@@ -187,6 +190,7 @@ public function configureOptions(OptionsResolver $resolver)
}
// Otherwise, an incrementing integer is used as value automatically
+ return null;
};
$emNormalizer = function (Options $options, $em) {
diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php
index a02437dab30f5..0079940bd56f6 100644
--- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php
+++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php
@@ -248,6 +248,8 @@ private function getMergeSql()
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
}
+
+ return null;
}
private function getServerVersion()
diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
index 1cadbeeda8ae1..1107146ff0cb8 100644
--- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
@@ -42,9 +42,9 @@ public function getProperties($class, array $context = [])
try {
$metadata = $this->classMetadataFactory->getMetadataFor($class);
} catch (MappingException $exception) {
- return;
+ return null;
} catch (OrmMappingException $exception) {
- return;
+ return null;
}
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
@@ -68,9 +68,9 @@ public function getTypes($class, $property, array $context = [])
try {
$metadata = $this->classMetadataFactory->getMetadataFor($class);
} catch (MappingException $exception) {
- return;
+ return null;
} catch (OrmMappingException $exception) {
- return;
+ return null;
}
if ($metadata->hasAssociation($property)) {
@@ -162,6 +162,8 @@ public function getTypes($class, $property, array $context = [])
return $builtinType ? [new Type($builtinType, $nullable)] : null;
}
}
+
+ return null;
}
/**
@@ -225,5 +227,7 @@ private function getPhpType($doctrineType)
case DBALType::OBJECT:
return Type::BUILTIN_TYPE_OBJECT;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php
index 1b8cba50f3ece..b851aee677e4b 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php
@@ -47,7 +47,7 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if (null === $value) {
- return;
+ return null;
}
if (!$value instanceof Foo) {
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)
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
- return;
+ return null;
}
if (!\is_string($value)) {
throw ConversionException::conversionFailed($value, self::NAME);
diff --git a/src/Symfony/Bridge/PhpUnit/ClockMock.php b/src/Symfony/Bridge/PhpUnit/ClockMock.php
index 4c5432f2603c4..07ce9c3a6085b 100644
--- a/src/Symfony/Bridge/PhpUnit/ClockMock.php
+++ b/src/Symfony/Bridge/PhpUnit/ClockMock.php
@@ -25,6 +25,8 @@ public static function withClockMock($enable = null)
}
self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
+
+ return null;
}
public static function time()
@@ -54,6 +56,8 @@ public static function usleep($us)
}
self::$now += $us / 1000000;
+
+ return null;
}
public static function microtime($asFloat = false)
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
index 22dbb829f931a..39676baf3e951 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
@@ -180,6 +180,8 @@ public static function register($mode = 0)
++$ref;
}
++$deprecations[$group.'Count'];
+
+ return null;
};
$oldErrorHandler = set_error_handler($deprecationHandler);
@@ -291,6 +293,8 @@ public static function collectDeprecations($outputFile)
return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
}
$deprecations[] = array(error_reporting(), $msg, $file);
+
+ return null;
});
register_shutdown_function(function () use ($outputFile, &$deprecations) {
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
index 1f9aabc5195a8..47486dfb26e28 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php
@@ -95,11 +95,7 @@ private function findSutFqcn($test)
$sutFqcn = str_replace('\\Tests\\', '\\', $class);
$sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
- if (!class_exists($sutFqcn)) {
- return;
- }
-
- return $sutFqcn;
+ return class_exists($sutFqcn) ? $sutFqcn : null;
}
public function __destruct()
diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
index 481a860aab132..4591f67ed51b8 100644
--- a/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
+++ b/src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php
@@ -357,6 +357,8 @@ public function handleError($type, $msg, $file, $line, $context = array())
$msg = 'Unsilenced deprecation: '.$msg;
}
$this->gatheredDeprecations[] = $msg;
+
+ return null;
}
/**
diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
index 5209e75863f98..dec8a5e77c602 100755
--- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
+++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
@@ -135,7 +135,7 @@ $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
if ($PHPUNIT_VERSION < 8.0) {
- $argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; });
+ $argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
$argv[] = '--do-not-cache-result';
++$argc;
diff --git a/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php b/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
index e3d98d800301a..1d75041113578 100644
--- a/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
+++ b/src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php
@@ -46,7 +46,7 @@ public static function generate(string $returnedValueExpression, ?\ReflectionMet
$functionLoader = $functionLoader[0];
}
if (!\is_object($functionLoader)) {
- return;
+ return null;
}
if ($functionLoader instanceof ClassLoader) {
return $functionLoader;
@@ -57,6 +57,8 @@ public static function generate(string $returnedValueExpression, ?\ReflectionMet
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
return $getComposerClassLoader($functionLoader->getClassLoader());
}
+
+ return null;
};
$classLoader = null;
diff --git a/src/Symfony/Bridge/Twig/AppVariable.php b/src/Symfony/Bridge/Twig/AppVariable.php
index e1f0ed4c38928..eb9cec6dd9101 100644
--- a/src/Symfony/Bridge/Twig/AppVariable.php
+++ b/src/Symfony/Bridge/Twig/AppVariable.php
@@ -83,9 +83,8 @@ public function getUser()
}
$user = $token->getUser();
- if (\is_object($user)) {
- return $user;
- }
+
+ return \is_object($user) ? $user : null;
}
/**
@@ -113,9 +112,7 @@ public function getSession()
throw new \RuntimeException('The "app.session" variable is not available.');
}
- if ($request = $this->getRequest()) {
- return $request->getSession();
- }
+ return ($request = $this->getRequest()) ? $request->getSession() : null;
}
/**
diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
index 618dce76c5a74..b45b580ee4b46 100644
--- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
@@ -220,16 +220,16 @@ private function getMetadata($type, $entity)
return $entity;
}
if ('tests' === $type) {
- return;
+ return null;
}
if ('functions' === $type || 'filters' === $type) {
$cb = $entity->getCallable();
if (null === $cb) {
- return;
+ return null;
}
if (\is_array($cb)) {
if (!method_exists($cb[0], $cb[1])) {
- return;
+ return null;
}
$refl = new \ReflectionMethod($cb[0], $cb[1]);
} elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
@@ -268,6 +268,8 @@ private function getMetadata($type, $entity)
return $args;
}
+
+ return null;
}
private function getPrettyMetadata($type, $entity, $decorated)
@@ -302,5 +304,7 @@ private function getPrettyMetadata($type, $entity, $decorated)
if ('filters' === $type) {
return $meta ? '('.implode(', ', $meta).')' : '';
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
index 88b75368da203..2be1056234d5f 100644
--- a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
@@ -55,7 +55,7 @@ public function getName()
public function dump(Environment $env, $context)
{
if (!$env->isDebug()) {
- return;
+ return null;
}
if (2 === \func_num_args()) {
diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
index 7952c475926e9..35e2eb21d0a54 100644
--- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
+++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
@@ -115,7 +115,7 @@ private function getReadDomainFromArguments(Node $arguments, $index)
} elseif ($arguments->hasNode($index)) {
$argument = $arguments->getNode($index);
} else {
- return;
+ return null;
}
return $this->getReadDomainFromNode($argument);
diff --git a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php
index 9c2d18b4a4d6e..43cac82bcbca5 100644
--- a/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php
+++ b/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php
@@ -71,6 +71,8 @@ public static function onUndefinedFilter($name)
}
self::onUndefined($name, 'filter', self::$filterComponents[$name]);
+
+ return true;
}
public static function onUndefinedFunction($name)
@@ -80,6 +82,8 @@ public static function onUndefinedFunction($name)
}
self::onUndefined($name, 'function', self::$functionComponents[$name]);
+
+ return true;
}
private static function onUndefined($name, $type, $component)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
index 37b179899830f..a4d2764b1132e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
@@ -86,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'For dumping a specific option, add its path as the second argument of this command. (e.g. config:dump-reference FrameworkBundle profiler.matcher to dump the framework.profiler.matcher configuration)',
]);
- return;
+ return null;
}
$extension = $this->findExtension($name);
@@ -129,5 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
index 72ac54856f073..84c87521cbd89 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
@@ -93,5 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->table([], $tableRows);
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
index b428b9e45c6a7..7ef64554274b8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
@@ -154,10 +154,13 @@ private function convertController(Route $route)
}
}
+ /**
+ * @return callable|null
+ */
private function extractCallable(Route $route)
{
if (!$route->hasDefault('_controller')) {
- return;
+ return null;
}
$controller = $route->getDefault('_controller');
@@ -178,5 +181,7 @@ private function extractCallable(Route $route)
return $controller;
} catch (\InvalidArgumentException $e) {
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
index 972c055bd162a..d6a1df8a0a514 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php
@@ -149,5 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
index 2a06b102e8c80..7375450d5d219 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
@@ -242,7 +242,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!\count($operation->getDomains())) {
$errorIo->warning('No translation messages were found.');
- return;
+ return null;
}
$resultMessage = 'Translation files were successfully updated';
@@ -307,6 +307,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$errorIo->success($resultMessage.'.');
+
+ return null;
}
private function filterCatalogue(MessageCatalogue $catalogue, $domain)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index b87e468c4ab3e..ea5d0c7d0bffa 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -142,7 +142,9 @@ protected function describeContainerDefinition(Definition $definition, array $op
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
{
if (!$builder) {
- return $this->writeData($this->getContainerAliasData($alias), $options);
+ $this->writeData($this->getContainerAliasData($alias), $options);
+
+ return;
}
$this->writeData(
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
index 6575b05ec81e8..2c31bdc19d611 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
@@ -249,7 +249,9 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
if (!isset($options['id'])) {
- return $this->write($output);
+ $this->write($output);
+
+ return;
}
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index 90b9c39def03e..43a811b92dba7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -369,7 +369,7 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
return;
}
- return $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
+ $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
index f3b15c8c38e6b..96b9a261ae3a3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
@@ -98,7 +98,9 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
if (!$builder) {
- return $this->writeDocument($dom);
+ $this->writeDocument($dom);
+
+ return;
}
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php
index aa5b4ba6804b5..dc47013b15966 100644
--- a/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php
+++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php
@@ -34,10 +34,6 @@ public function __construct(ContainerInterface $container)
protected function getSession()
{
- if (!$this->container->has('session')) {
- return;
- }
-
- return $this->container->get('session');
+ return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
index 55356be040386..0e94341e7878d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
+++ b/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php
@@ -34,10 +34,6 @@ public function __construct(ContainerInterface $container)
protected function getSession()
{
- if (!$this->container->has('session')) {
- return;
- }
-
- return $this->container->get('session');
+ return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php
index 866cf32f9f0cf..ad5aee77fe2bb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php
@@ -45,15 +45,12 @@ public function getToken()
public function getUser()
{
if (!$token = $this->getToken()) {
- return;
+ return null;
}
$user = $token->getUser();
- if (!\is_object($user)) {
- return;
- }
- return $user;
+ return \is_object($user) ? $user : null;
}
/**
@@ -61,9 +58,7 @@ public function getUser()
*/
public function getRequest()
{
- if ($this->container->has('request_stack')) {
- return $this->container->get('request_stack')->getCurrentRequest();
- }
+ return $this->container->has('request_stack') ? $this->container->get('request_stack')->getCurrentRequest() : null;
}
/**
@@ -71,9 +66,7 @@ public function getRequest()
*/
public function getSession()
{
- if ($request = $this->getRequest()) {
- return $request->getSession();
- }
+ return ($request = $this->getRequest()) ? $request->getSession() : null;
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
index 38f2039ee56ad..a0a77f8d1e018 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
@@ -110,7 +110,7 @@ public function formatArgs(array $args)
* @param string $file A file path
* @param int $line The selected line number
*
- * @return string An HTML string
+ * @return string|null An HTML string
*/
public function fileExcerpt($file, $line)
{
@@ -138,6 +138,8 @@ public function fileExcerpt($file, $line)
return '
'.implode("\n", $lines).'
';
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php
index 55232c46203a8..2964cd35b5695 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/StopwatchHelper.php
@@ -35,12 +35,14 @@ public function getName()
public function __call($method, $arguments = [])
{
- if (null !== $this->stopwatch) {
- if (method_exists($this->stopwatch, $method)) {
- return \call_user_func_array([$this->stopwatch, $method], $arguments);
- }
+ if (null === $this->stopwatch) {
+ return null;
+ }
- throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
+ if (method_exists($this->stopwatch, $method)) {
+ return \call_user_func_array([$this->stopwatch, $method], $arguments);
}
+
+ throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index ca47e33a629cc..1fd0fdba03eae 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -85,7 +85,9 @@ public function testPropertyAccessCache()
$container = $this->createContainerFromFile('property_accessor');
if (!method_exists(PropertyAccessor::class, 'createCache')) {
- return $this->assertFalse($container->hasDefinition('cache.property_access'));
+ $this->assertFalse($container->hasDefinition('cache.property_access'));
+
+ return;
}
$cache = $container->getDefinition('cache.property_access');
@@ -98,7 +100,9 @@ public function testPropertyAccessCacheWithDebug()
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
if (!method_exists(PropertyAccessor::class, 'createCache')) {
- return $this->assertFalse($container->hasDefinition('cache.property_access'));
+ $this->assertFalse($container->hasDefinition('cache.property_access'));
+
+ return;
}
$cache = $container->getDefinition('cache.property_access');
diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
index d67e625c579ff..b92addaa8a892 100644
--- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
+++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php
@@ -109,5 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$output->writeln('ACL tables have been initialized successfully.');
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
index 6ce92044c7f41..a5537eca5d208 100644
--- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
+++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
@@ -168,6 +168,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$errorIo->success('Password encoding succeeded');
+
+ return null;
}
/**
diff --git a/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php b/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php
index 5ba6df59932fd..7595f5674a1fb 100644
--- a/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php
+++ b/src/Symfony/Bundle/TwigBundle/ContainerAwareRuntimeLoader.php
@@ -49,5 +49,7 @@ public function load($class)
if (null !== $this->logger) {
$this->logger->warning(sprintf('Class "%s" is not configured as a Twig runtime. Add the "twig.runtime" tag to the related service in the container.', $class));
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
index a1e23041f8aac..c55c67e537a02 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php
@@ -98,9 +98,7 @@ public function testReturns404onTokenNotFound($withCsp)
->expects($this->exactly(2))
->method('loadProfile')
->willReturnCallback(function ($token) {
- if ('found' == $token) {
- return new Profile($token);
- }
+ return 'found' == $token ? new Profile($token) : null;
})
;
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
index 415b372830345..820cb8e284567 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
@@ -155,5 +155,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
index 36d6d290e6435..a1f9e0ce275fe 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
@@ -88,5 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
index c4edd3700326a..b4f0d74848a6c 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
@@ -62,5 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php b/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php
index 059ea3beb5590..7548eef576983 100644
--- a/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php
+++ b/src/Symfony/Bundle/WebServerBundle/WebServerConfig.php
@@ -101,6 +101,12 @@ public function getAddress()
return $this->hostname.':'.$this->port;
}
+ /**
+ * @param string $documentRoot
+ * @param string $env
+ *
+ * @return string|null
+ */
private function findFrontController($documentRoot, $env)
{
$fileNames = $this->getFrontControllerFileNames($env);
@@ -110,13 +116,23 @@ private function findFrontController($documentRoot, $env)
return $fileName;
}
}
+
+ return null;
}
+ /**
+ * @param string $env
+ *
+ * @return array
+ */
private function getFrontControllerFileNames($env)
{
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
}
+ /**
+ * @return int
+ */
private function findBestPort()
{
$port = 8000;
diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php
index 835af19574515..813236d482ba3 100644
--- a/src/Symfony/Component/BrowserKit/CookieJar.php
+++ b/src/Symfony/Component/BrowserKit/CookieJar.php
@@ -60,6 +60,8 @@ public function get($name, $path = '/', $domain = null)
}
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
index 433d4eb132b1f..8e6024d846075 100644
--- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
@@ -177,6 +177,8 @@ public function getItem($key)
foreach ($this->getItems([$key]) as $item) {
return $item;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/ClassLoader/ApcClassLoader.php b/src/Symfony/Component/ClassLoader/ApcClassLoader.php
index 83038d749f78d..57d22bfa358ea 100644
--- a/src/Symfony/Component/ClassLoader/ApcClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/ApcClassLoader.php
@@ -113,6 +113,8 @@ public function loadClass($class)
return true;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/ClassLoader/ClassLoader.php b/src/Symfony/Component/ClassLoader/ClassLoader.php
index d727278ee81b6..277aa523df71a 100644
--- a/src/Symfony/Component/ClassLoader/ClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/ClassLoader.php
@@ -161,6 +161,8 @@ public function loadClass($class)
return true;
}
+
+ return null;
}
/**
@@ -203,5 +205,7 @@ public function findFile($class)
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/ClassLoader/MapClassLoader.php b/src/Symfony/Component/ClassLoader/MapClassLoader.php
index a9719d6bd2683..e6b89e5143464 100644
--- a/src/Symfony/Component/ClassLoader/MapClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/MapClassLoader.php
@@ -63,8 +63,6 @@ public function loadClass($class)
*/
public function findFile($class)
{
- if (isset($this->map[$class])) {
- return $this->map[$class];
- }
+ return isset($this->map[$class]) ? $this->map[$class] : null;
}
}
diff --git a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php
index 7ea521d82e6e7..f4e79cab627d7 100644
--- a/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/Psr4ClassLoader.php
@@ -55,6 +55,8 @@ public function findFile($class)
}
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php b/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php
index a7149ce9daf3e..374608bb87d6a 100644
--- a/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/WinCacheClassLoader.php
@@ -112,6 +112,8 @@ public function loadClass($class)
return true;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php
index 56965df4c8ea9..d236bb4f07a34 100644
--- a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php
+++ b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php
@@ -106,6 +106,8 @@ public function loadClass($class)
return true;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
index 62003692c6f3d..744f15fd81b5a 100644
--- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
+++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
@@ -306,5 +306,7 @@ private function writeValue($value)
if (\is_array($value)) {
return implode(',', $value);
}
+
+ return '';
}
}
diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php
index abaf1767d90a4..5ad53885c726a 100644
--- a/src/Symfony/Component/Config/Loader/FileLoader.php
+++ b/src/Symfony/Component/Config/Loader/FileLoader.php
@@ -168,5 +168,7 @@ private function doImport($resource, $type = null, $ignoreErrors = false, $sourc
throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/Console/EventListener/ErrorListener.php b/src/Symfony/Component/Console/EventListener/ErrorListener.php
index 212ad1d96ff4f..783c10793f2c9 100644
--- a/src/Symfony/Component/Console/EventListener/ErrorListener.php
+++ b/src/Symfony/Component/Console/EventListener/ErrorListener.php
@@ -40,7 +40,9 @@ public function onConsoleError(ConsoleErrorEvent $event)
$error = $event->getError();
if (!$inputString = $this->getInputString($event)) {
- return $this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
+ $this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
+
+ return;
}
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
@@ -59,7 +61,9 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event)
}
if (!$inputString = $this->getInputString($event)) {
- return $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
+ $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
+
+ return;
}
$this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index cc1f6079e4535..b0c167d6905fa 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -288,6 +288,8 @@ public function getFirstArgument()
return $token;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php
index 9f8f93a65ef88..a04b6b68ea0c8 100644
--- a/src/Symfony/Component/Console/Input/ArrayInput.php
+++ b/src/Symfony/Component/Console/Input/ArrayInput.php
@@ -46,6 +46,8 @@ public function getFirstArgument()
return $value;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php
index e0ced01b22744..4291ada8f6cd6 100644
--- a/src/Symfony/Component/Console/Style/SymfonyStyle.php
+++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php
@@ -355,7 +355,9 @@ private function autoPrependBlock()
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
if (!isset($chars[0])) {
- return $this->newLine(); //empty history, so we should start with a new line.
+ $this->newLine(); //empty history, so we should start with a new line.
+
+ return;
}
//Prepend new line for each non LF chars (This means no blank line was output before)
$this->newLine(2 - substr_count($chars, "\n"));
diff --git a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php
index 55ea42149329e..ce322e96fdf92 100644
--- a/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php
+++ b/src/Symfony/Component/CssSelector/Parser/Tokenizer/TokenizerEscaping.php
@@ -73,6 +73,8 @@ private function replaceUnicodeSequences($value)
if (0x10000 > $c) {
return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
}
+
+ return '';
}, $value);
}
}
diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php
index 13ab9e700c743..a3b7ac63234ea 100644
--- a/src/Symfony/Component/Debug/DebugClassLoader.php
+++ b/src/Symfony/Component/Debug/DebugClassLoader.php
@@ -317,6 +317,12 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
return $deprecations;
}
+ /**
+ * @param string $file
+ * @param string $class
+ *
+ * @return array|null
+ */
public function checkCase(\ReflectionClass $refl, $file, $class)
{
$real = explode('\\', $class.strrchr($file, '.'));
@@ -333,7 +339,7 @@ public function checkCase(\ReflectionClass $refl, $file, $class)
array_splice($tail, 0, $i + 1);
if (!$tail) {
- return;
+ return null;
}
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
@@ -349,6 +355,8 @@ public function checkCase(\ReflectionClass $refl, $file, $class)
) {
return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php
index 7fe15ee39a400..794f5ca029ea0 100644
--- a/src/Symfony/Component/Debug/ErrorHandler.php
+++ b/src/Symfony/Component/Debug/ErrorHandler.php
@@ -599,7 +599,9 @@ public function handleException($exception, array $error = null)
$this->exceptionHandler = null;
try {
if (null !== $exceptionHandler) {
- return \call_user_func($exceptionHandler, $exception);
+ $exceptionHandler($exception);
+
+ return;
}
$handlerException = $handlerException ?: $exception;
} catch (\Exception $handlerException) {
diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
index 094d25ee679d0..9bae6f86566fb 100644
--- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
+++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
@@ -71,6 +71,8 @@ public function handleError(array $error, FatalErrorException $exception)
return new ClassNotFoundException($message, $exception);
}
+
+ return null;
}
/**
@@ -196,6 +198,8 @@ private function convertFileToClass($path, $file, $prefix)
return $candidate;
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index 9abbc33eb1b17..0388acba029ba 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -439,5 +439,7 @@ public function internalMethod() { }
} elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }');
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
index 8070920ff7ffe..bff9d42079e12 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php
@@ -156,7 +156,7 @@ private function getDefinitionId($id)
}
if (!$this->container->hasDefinition($id)) {
- return;
+ return null;
}
return $this->container->normalizeId($id);
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php
index feb05c0499494..30a6f524ade46 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php
@@ -81,5 +81,7 @@ protected function processValue($value, $isRoot = false)
}
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index 4797047bbc3e8..53873c15e6252 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -354,7 +354,7 @@ public function addClassResource(\ReflectionClass $class)
public function getReflectionClass($class, $throw = true)
{
if (!$class = $this->getParameterBag()->resolveValue($class)) {
- return;
+ return null;
}
if (isset(self::$internalTypes[$class])) {
@@ -621,7 +621,7 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_
$definition = $this->getDefinition($id);
} catch (ServiceNotFoundException $e) {
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
- return;
+ return null;
}
throw $e;
diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
index a23b83436bbe5..8854080939997 100644
--- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
+++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
@@ -65,7 +65,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
if (false !== $i || 'string' !== $prefix) {
if (null === $env = $getEnv($name)) {
- return;
+ return null;
}
} elseif (isset($_ENV[$name])) {
$env = $_ENV[$name];
@@ -77,7 +77,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
}
if (null === $env = $this->container->getParameter("env($name)")) {
- return;
+ return null;
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php
index a9389862ccbe2..7df483064f11d 100644
--- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php
+++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php
@@ -84,11 +84,12 @@ public function getConfiguration(array $config, ContainerBuilder $container)
$class = $container->getReflectionClass($class);
$constructor = $class ? $class->getConstructor() : null;
- if ($class && (!$constructor || !$constructor->getNumberOfRequiredParameters())) {
- return $class->newInstance();
- }
+ return $class && (!$constructor || !$constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null;
}
+ /**
+ * @return array
+ */
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
{
$processor = new Processor();
diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
index 33737082a6e83..cb19c729c100c 100644
--- a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
+++ b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
@@ -58,8 +58,7 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa
if ('self' === $lcName) {
return $prefix.$r->getDeclaringClass()->name;
}
- if ($parent = $r->getDeclaringClass()->getParentClass()) {
- return $prefix.$parent->name;
- }
+
+ return ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null;
}
}
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 5609f464a216b..1e7ba789a1fc4 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -1053,9 +1053,7 @@ private function relativize($xpath)
*/
public function getNode($position)
{
- if (isset($this->nodes[$position])) {
- return $this->nodes[$position];
- }
+ return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
}
/**
@@ -1115,7 +1113,7 @@ private function createDOMXPath(\DOMDocument $document, array $prefixes = [])
/**
* @param string $prefix
*
- * @return string
+ * @return string|null
*
* @throws \InvalidArgumentException
*/
@@ -1128,9 +1126,7 @@ private function discoverNamespace(\DOMXPath $domxpath, $prefix)
// ask for one namespace, otherwise we'd get a collection with an item for each node
$namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix));
- if ($node = $namespaces->item(0)) {
- return $node->nodeValue;
- }
+ return ($node = $namespaces->item(0)) ? $node->nodeValue : null;
}
/**
diff --git a/src/Symfony/Component/DomCrawler/Field/FormField.php b/src/Symfony/Component/DomCrawler/Field/FormField.php
index 33c0bbeac042f..51d875514c6d3 100644
--- a/src/Symfony/Component/DomCrawler/Field/FormField.php
+++ b/src/Symfony/Component/DomCrawler/Field/FormField.php
@@ -72,9 +72,8 @@ public function getLabel()
}
$labels = $xpath->query('ancestor::label[1]', $this->node);
- if ($labels->length > 0) {
- return $labels->item(0);
- }
+
+ return $labels->length > 0 ? $labels->item(0) : null;
}
/**
diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
index 968e345b3dcab..207790f06b0f9 100644
--- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
@@ -79,7 +79,7 @@ public function getListeners($eventName = null)
public function getListenerPriority($eventName, $listener)
{
if (empty($this->listeners[$eventName])) {
- return;
+ return null;
}
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
@@ -97,6 +97,8 @@ public function getListenerPriority($eventName, $listener)
}
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
index 0948bc1857f1a..6fb9eba7334ff 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
@@ -21,7 +21,7 @@ class FilesystemTestCase extends TestCase
protected $longPathNamesWindows = [];
/**
- * @var \Symfony\Component\Filesystem\Filesystem
+ * @var Filesystem
*/
protected $filesystem = null;
@@ -110,9 +110,8 @@ protected function getFileOwner($filepath)
$this->markAsSkippedIfPosixIsMissing();
$infos = stat($filepath);
- if ($datas = posix_getpwuid($infos['uid'])) {
- return $datas['name'];
- }
+
+ return ($datas = posix_getpwuid($infos['uid'])) ? $datas['name'] : null;
}
protected function getFileGroup($filepath)
diff --git a/src/Symfony/Component/Form/AbstractExtension.php b/src/Symfony/Component/Form/AbstractExtension.php
index d5ab6bd48b883..22b8ae38547a6 100644
--- a/src/Symfony/Component/Form/AbstractExtension.php
+++ b/src/Symfony/Component/Form/AbstractExtension.php
@@ -140,6 +140,7 @@ protected function loadTypeExtensions()
*/
protected function loadTypeGuesser()
{
+ return null;
}
/**
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
index 82bbbd7932f22..3f8e035f89d29 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
@@ -80,9 +80,7 @@ public function createListFromChoices($choices, $value = null)
// when such values are passed to
// ChoiceListInterface::getValuesForChoices(). Handle this case
// so that the call to getValue() doesn't break.
- if (\is_object($choice) || \is_array($choice)) {
- return $accessor->getValue($choice, $value);
- }
+ return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
};
}
@@ -113,9 +111,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
// when such values are passed to
// ChoiceListInterface::getValuesForChoices(). Handle this case
// so that the call to getValue() doesn't break.
- if (\is_object($choice) || \is_array($choice)) {
- return $accessor->getValue($choice, $value);
- }
+ return \is_object($choice) || \is_array($choice) ? $accessor->getValue($choice, $value) : null;
};
}
@@ -191,6 +187,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
return $accessor->getValue($choice, $groupBy);
} catch (UnexpectedTypeException $e) {
// Don't group if path is not readable
+ return null;
}
};
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php
index 2879dffdbc466..b073a123cfd53 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php
@@ -73,7 +73,7 @@ public function reverseTransform($array)
if (\count($emptyKeys) > 0) {
if (\count($emptyKeys) === \count($this->partMapping)) {
// All parts empty
- return;
+ return null;
}
throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)));
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php
index fae30857fff85..cad078285fccb 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php
@@ -42,7 +42,7 @@ public function reverseTransform($value)
if (1 !== \count($choices)) {
if (null === $value || '' === $value) {
- return;
+ return null;
}
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php
index bec7509fb7fe8..cf8b22b673e94 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeZoneToStringTransformer.php
@@ -34,7 +34,7 @@ public function __construct($multiple = false)
public function transform($dateTimeZone)
{
if (null === $dateTimeZone) {
- return;
+ return null;
}
if ($this->multiple) {
@@ -58,7 +58,7 @@ public function transform($dateTimeZone)
public function reverseTransform($value)
{
if (null === $value) {
- return;
+ return null;
}
if ($this->multiple) {
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
index 2ad0859e880fa..e29896fa61857 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -251,7 +251,7 @@ public function configureOptions(OptionsResolver $resolver)
{
$emptyData = function (Options $options) {
if ($options['expanded'] && !$options['multiple']) {
- return;
+ return null;
}
if ($options['multiple']) {
@@ -284,13 +284,13 @@ public function configureOptions(OptionsResolver $resolver)
$placeholderNormalizer = function (Options $options, $placeholder) {
if ($options['multiple']) {
// never use an empty value for this case
- return;
+ return null;
} elseif ($options['required'] && ($options['expanded'] || isset($options['attr']['size']) && $options['attr']['size'] > 1)) {
// placeholder for required radio buttons or a select with size > 1 does not make sense
- return;
+ return null;
} elseif (false === $placeholder) {
// an empty value should be added but the user decided otherwise
- return;
+ return null;
} elseif ($options['expanded'] && '' === $placeholder) {
// never use an empty label for radio buttons
return 'None';
@@ -380,9 +380,6 @@ private function addSubForms(FormBuilderInterface $builder, array $choiceViews,
}
}
- /**
- * @return mixed
- */
private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $choiceView, array $options)
{
$choiceOpts = [
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
index 63505ba2333db..0e9e2a9d7ecbb 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
@@ -36,7 +36,7 @@ public function configureOptions(OptionsResolver $resolver)
}
if (empty($groups)) {
- return;
+ return null;
}
if (\is_callable($groups)) {
diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
index 22cc7726d4a79..80ec926a94b29 100644
--- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
+++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
@@ -153,6 +153,8 @@ public function guessTypeForConstraint(Constraint $constraint)
case 'Symfony\Component\Validator\Constraints\IsFalse':
return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::MEDIUM_CONFIDENCE);
}
+
+ return null;
}
/**
@@ -168,6 +170,8 @@ public function guessRequiredForConstraint(Constraint $constraint)
case 'Symfony\Component\Validator\Constraints\IsTrue':
return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
}
+
+ return null;
}
/**
@@ -196,6 +200,8 @@ public function guessMaxLengthForConstraint(Constraint $constraint)
}
break;
}
+
+ return null;
}
/**
@@ -232,6 +238,8 @@ public function guessPatternForConstraint(Constraint $constraint)
}
break;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
index d300f50286476..fcd70c9d3e01e 100644
--- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
+++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
@@ -54,9 +54,7 @@ public function getOrigin()
*/
public function match($propertyPath)
{
- if ($propertyPath === $this->propertyPath) {
- return $this->getTarget();
- }
+ return $propertyPath === $this->propertyPath ? $this->getTarget() : null;
}
/**
diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php
index dc82afb10309c..67fd234fe9612 100644
--- a/src/Symfony/Component/Form/Form.php
+++ b/src/Symfony/Component/Form/Form.php
@@ -757,9 +757,7 @@ public function getClickedButton()
return $this->clickedButton;
}
- if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
- return $this->parent->getClickedButton();
- }
+ return $this->parent && method_exists($this->parent, 'getClickedButton') ? $this->parent->getClickedButton() : null;
}
/**
diff --git a/src/Symfony/Component/Form/Util/StringUtil.php b/src/Symfony/Component/Form/Util/StringUtil.php
index 241a66810b417..ce507e9ee21f8 100644
--- a/src/Symfony/Component/Form/Util/StringUtil.php
+++ b/src/Symfony/Component/Form/Util/StringUtil.php
@@ -53,5 +53,7 @@ public static function fqcnToBlockPrefix($fqcn)
if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $matches[1]));
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php
index 80f4d47f767c0..f9393df90072d 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php
@@ -90,5 +90,7 @@ public function guess($mimeType)
return $extension;
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
index 95d1ee26762a5..e05269fc80333 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
@@ -129,5 +129,7 @@ public function guess($path)
if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 9557dac302ff8..3b9bf2f49e2f9 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -97,49 +97,49 @@ class Request
/**
* Custom parameters.
*
- * @var \Symfony\Component\HttpFoundation\ParameterBag
+ * @var ParameterBag
*/
public $attributes;
/**
* Request body parameters ($_POST).
*
- * @var \Symfony\Component\HttpFoundation\ParameterBag
+ * @var ParameterBag
*/
public $request;
/**
* Query string parameters ($_GET).
*
- * @var \Symfony\Component\HttpFoundation\ParameterBag
+ * @var ParameterBag
*/
public $query;
/**
* Server and execution environment parameters ($_SERVER).
*
- * @var \Symfony\Component\HttpFoundation\ServerBag
+ * @var ServerBag
*/
public $server;
/**
* Uploaded files ($_FILES).
*
- * @var \Symfony\Component\HttpFoundation\FileBag
+ * @var FileBag
*/
public $files;
/**
* Cookies ($_COOKIE).
*
- * @var \Symfony\Component\HttpFoundation\ParameterBag
+ * @var ParameterBag
*/
public $cookies;
/**
* Headers (taken from the $_SERVER).
*
- * @var \Symfony\Component\HttpFoundation\HeaderBag
+ * @var HeaderBag
*/
public $headers;
@@ -199,7 +199,7 @@ class Request
protected $format;
/**
- * @var \Symfony\Component\HttpFoundation\Session\SessionInterface
+ * @var SessionInterface
*/
protected $session;
@@ -1449,6 +1449,8 @@ public function getFormat($mimeType)
return $format;
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index 47dae95345cd4..eae9b78414684 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -88,7 +88,7 @@ class Response
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
/**
- * @var \Symfony\Component\HttpFoundation\ResponseHeaderBag
+ * @var ResponseHeaderBag
*/
public $headers;
@@ -790,6 +790,8 @@ public function getMaxAge()
if (null !== $this->getExpires()) {
return (int) $this->getExpires()->format('U') - (int) $this->getDate()->format('U');
}
+
+ return null;
}
/**
@@ -846,6 +848,8 @@ public function getTtl()
if (null !== $maxAge = $this->getMaxAge()) {
return $maxAge - $this->getAge();
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
index c4036175c4b66..5bbed6bef1bd0 100644
--- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
+++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php
@@ -87,9 +87,7 @@ public function getContainerExtension()
}
}
- if ($this->extension) {
- return $this->extension;
- }
+ return $this->extension ?: null;
}
/**
@@ -199,9 +197,7 @@ protected function getContainerExtensionClass()
*/
protected function createContainerExtension()
{
- if (class_exists($class = $this->getContainerExtensionClass())) {
- return new $class();
- }
+ return class_exists($class = $this->getContainerExtensionClass()) ? new $class() : null;
}
private function parseClassName()
diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php
index 73014abd96813..2548a2a083c39 100644
--- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php
+++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php
@@ -103,17 +103,17 @@ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbs
{
if ($this->supportsParameterType) {
if (!$type = $parameter->getType()) {
- return;
+ return null;
}
$name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
if ('array' === $name && !$type->isBuiltin()) {
// Special case for HHVM with variadics
- return;
+ return null;
}
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) {
$name = $name[1];
} else {
- return;
+ return null;
}
$lcName = strtolower($name);
@@ -121,7 +121,7 @@ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbs
return $name;
}
if (!$function instanceof \ReflectionMethod) {
- return;
+ return null;
}
if ('self' === $lcName) {
return $function->getDeclaringClass()->name;
@@ -129,5 +129,7 @@ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbs
if ($parent = $function->getDeclaringClass()->getParentClass()) {
return $parent->name;
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
index af65f7ec5725d..2e217c51cca7c 100644
--- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
+++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
@@ -102,7 +102,7 @@ private function getFileLinkFormat()
$request = $this->requestStack->getMasterRequest();
if ($request instanceof Request) {
if ($this->urlFormat instanceof \Closure && !$this->urlFormat = \call_user_func($this->urlFormat)) {
- return;
+ return null;
}
return [
@@ -111,5 +111,7 @@ private function getFileLinkFormat()
];
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php b/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php
index f40da0018bc17..9629cf706669c 100644
--- a/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php
+++ b/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php
@@ -108,5 +108,7 @@ protected function deliver(Response $response)
}
$response->sendContent();
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php
index 8918a3057056e..1d62f32e67fb0 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php
@@ -109,6 +109,8 @@ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors)
throw $e;
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
index dc62990b408c9..96e6ca4bfe617 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Esi.php
@@ -111,5 +111,7 @@ public function process(Request $request, Response $response)
// remove ESI/1.0 from the Surrogate-Control header
$this->removeFromControl($response);
+
+ return $response;
}
}
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php b/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php
index eaaa230b50ee9..707abca5eb7ac 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/Ssi.php
@@ -94,5 +94,7 @@ public function process(Request $request, Response $response)
// remove SSI/1.0 from the Surrogate-Control header
$this->removeFromControl($response);
+
+ return null;
}
}
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 6d71214f1be70..a7d7977db460c 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -607,7 +607,7 @@ protected function initializeContainer()
if (isset($collectedLogs[$message])) {
++$collectedLogs[$message]['count'];
- return;
+ return null;
}
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
@@ -627,6 +627,8 @@ protected function initializeContainer()
'trace' => $backtrace,
'count' => 1,
];
+
+ return null;
});
}
diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
index cdbfec432c783..0a078e7b98686 100644
--- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
+++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php
@@ -248,16 +248,19 @@ public function get($name)
return $this->collectors[$name];
}
+ /**
+ * @return int|null
+ */
private function getTimestamp($value)
{
if (null === $value || '' == $value) {
- return;
+ return null;
}
try {
$value = new \DateTime(is_numeric($value) ? '@'.$value : $value);
} catch (\Exception $e) {
- return;
+ return null;
}
return $value->getTimestamp();
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
index 5ced7e5b8bb92..2aca5459ce41b 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php
@@ -88,7 +88,7 @@ public function testProcessDoesNothingIfContentTypeIsNotHtml()
$request = Request::create('/');
$response = new Response();
$response->headers->set('Content-Type', 'text/plain');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertFalse($response->headers->has('x-body-eval'));
}
@@ -99,7 +99,7 @@ public function testMultilineEsiRemoveTagsAreRemoved()
$request = Request::create('/');
$response = new Response(' www.example.com Keep this'."\n www.example.com And this");
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals(' Keep this And this', $response->getContent());
}
@@ -110,7 +110,7 @@ public function testCommentTagsAreRemoved()
$request = Request::create('/');
$response = new Response(' Keep this');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals(' Keep this', $response->getContent());
}
@@ -121,23 +121,23 @@ public function testProcess()
$request = Request::create('/');
$response = new Response('foo ');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('foo surrogate->handle($this, \'...\', \'alt\', true) ?>'."\n", $response->getContent());
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$response = new Response('foo ');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('foo surrogate->handle($this, \'foo\\\'\', \'bar\\\'\', true) ?>'."\n", $response->getContent());
$response = new Response('foo ');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('foo surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
$response = new Response('foo ');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('foo surrogate->handle($this, \'...\', \'\', false) ?>'."\n", $response->getContent());
}
@@ -148,7 +148,7 @@ public function testProcessEscapesPhpTags()
$request = Request::create('/');
$response = new Response('');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('php cript language=php>', $response->getContent());
}
@@ -160,7 +160,7 @@ public function testProcessWhenNoSrcInAnEsi()
$request = Request::create('/');
$response = new Response('foo ');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
}
public function testProcessRemoveSurrogateControlHeader()
@@ -170,16 +170,16 @@ public function testProcessRemoveSurrogateControlHeader()
$request = Request::create('/');
$response = new Response('foo ');
$response->headers->set('Surrogate-Control', 'content="ESI/1.0"');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$response->headers->set('Surrogate-Control', 'no-store, content="ESI/1.0"');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
$response->headers->set('Surrogate-Control', 'content="ESI/1.0", no-store');
- $esi->process($request, $response);
+ $this->assertSame($response, $esi->process($request, $response));
$this->assertEquals('ESI', $response->headers->get('x-body-eval'));
$this->assertEquals('no-store', $response->headers->get('surrogate-control'));
}
diff --git a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
index fead9927a9136..0fc70c198b9ef 100644
--- a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
@@ -90,6 +90,8 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
return $data;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
index 73b15b6f1c763..2306b1cedac94 100644
--- a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
@@ -134,6 +134,8 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
return $data;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php
index 25deae2fa5f90..69c6df26d0bf1 100644
--- a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php
@@ -104,6 +104,8 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
return $data;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php
index 50f8dd2c10fb0..a6d60a8fcdbaa 100644
--- a/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php
+++ b/src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php
@@ -73,6 +73,8 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
return $data;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
index 13854ff719ef8..696f38fe1d337 100644
--- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
+++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php
@@ -101,7 +101,7 @@ public function format(\DateTime $dateTime)
* @param string $dateChars The date characters to be replaced with a formatted ICU value
* @param \DateTime $dateTime A DateTime object to be used to generate the formatted value
*
- * @return string The formatted value
+ * @return string|null The formatted value
*
* @throws NotImplementedException When it encounters a not implemented date character
*/
@@ -123,6 +123,8 @@ public function formatReplace($dateChars, $dateTime)
if (false !== strpos($this->notImplementedChars, $dateChars[0])) {
throw new NotImplementedException(sprintf('Unimplemented date character "%s" in format "%s"', $dateChars[0], $this->pattern));
}
+
+ return null;
}
/**
@@ -196,6 +198,8 @@ public function getReverseMatchingRegExp($pattern)
return "(?P<$captureName>".$transformer->getReverseMatchingRegExp($length).')';
}
+
+ return null;
}, $escapedPattern);
return $reverseMatchingRegExp;
diff --git a/src/Symfony/Component/Intl/Locale.php b/src/Symfony/Component/Intl/Locale.php
index 9f810235e6f85..43418ffa3ca8d 100644
--- a/src/Symfony/Component/Intl/Locale.php
+++ b/src/Symfony/Component/Intl/Locale.php
@@ -104,9 +104,7 @@ public static function getFallback($locale)
// Don't return default fallback for "root", "meta" or others
// Normal locales have two or three letters
- if (\strlen($locale) < 4) {
- return self::$defaultFallback;
- }
+ return \strlen($locale) < 4 ? self::$defaultFallback : null;
}
/**
diff --git a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php
index c4d296a73b9db..1abe86a84c207 100644
--- a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php
+++ b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php
@@ -83,7 +83,7 @@ public function getFractionDigits($currency)
try {
return parent::getFractionDigits($currency);
} catch (MissingResourceException $e) {
- return;
+ return null;
}
}
@@ -95,7 +95,7 @@ public function getRoundingIncrement($currency)
try {
return parent::getRoundingIncrement($currency);
} catch (MissingResourceException $e) {
- return;
+ return null;
}
}
diff --git a/src/Symfony/Component/Intl/Resources/bin/common.php b/src/Symfony/Component/Intl/Resources/bin/common.php
index addaa9415ee1a..8ebf9fdc6057b 100644
--- a/src/Symfony/Component/Intl/Resources/bin/common.php
+++ b/src/Symfony/Component/Intl/Resources/bin/common.php
@@ -62,7 +62,7 @@ function get_icu_version_from_genrb($genrb)
}
if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) {
- return;
+ return null;
}
return $matches[1];
diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php
index 23886b616387f..9dd415d5c9a9a 100644
--- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php
+++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php
@@ -88,12 +88,14 @@ protected function unblock()
/**
* Writes input to stdin.
*
+ * @return array|null
+ *
* @throws InvalidArgumentException When an input iterator yields a non supported value
*/
protected function write()
{
if (!isset($this->pipes[0])) {
- return;
+ return null;
}
$input = $this->input;
@@ -122,7 +124,7 @@ protected function write()
// let's have a look if something changed in streams
if (false === @stream_select($r, $w, $e, 0, 0)) {
- return;
+ return null;
}
foreach ($w as $stdin) {
@@ -166,6 +168,8 @@ protected function write()
} elseif (!$w) {
return [$this->pipes[0]];
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 55b2fabbfcc80..9a7c515e8a5ec 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -1231,6 +1231,8 @@ public function testInputStreamWithCallable()
return $stream;
}
+
+ return null;
};
$input = new InputStream();
diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php
index 0d6c1f0ba97d9..d49967abd1a66 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php
@@ -33,5 +33,7 @@ public function __call($method, array $args)
if ('setMagicCallProperty' === $method) {
$this->magicCallProperty = reset($args);
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php
index 2df790045cd74..76b6c43400791 100644
--- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php
+++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php
@@ -89,6 +89,8 @@ public function getShortDescription($class, $property, array $context = [])
return $varDescription;
}
}
+
+ return null;
}
/**
@@ -203,7 +205,7 @@ private function getDocBlockFromProperty($class, $property)
try {
$reflectionProperty = new \ReflectionProperty($class, $property);
} catch (\ReflectionException $e) {
- return;
+ return null;
}
try {
@@ -248,7 +250,7 @@ private function getDocBlockFromMethod($class, $ucFirstProperty, $type)
}
if (!isset($reflectionMethod)) {
- return;
+ return null;
}
try {
diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
index 112a030586d89..bb8138dc1a88d 100644
--- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
+++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
@@ -124,6 +124,8 @@ public function getTypes($class, $property, array $context = [])
if ($fromAccessor = $this->extractFromAccessor($class, $property)) {
return $fromAccessor;
}
+
+ return null;
}
/**
@@ -166,7 +168,7 @@ private function extractFromMutator($class, $property)
{
list($reflectionMethod, $prefix) = $this->getMutatorMethod($class, $property);
if (null === $reflectionMethod) {
- return;
+ return null;
}
$reflectionParameters = $reflectionMethod->getParameters();
@@ -174,13 +176,13 @@ private function extractFromMutator($class, $property)
if ($this->supportsParameterType) {
if (!$reflectionType = $reflectionParameter->getType()) {
- return;
+ return null;
}
$type = $this->extractFromReflectionType($reflectionType, $reflectionMethod);
// HHVM reports variadics with "array" but not builtin type hints
if (!$reflectionType->isBuiltin() && Type::BUILTIN_TYPE_ARRAY === $type->getBuiltinType()) {
- return;
+ return null;
}
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $reflectionParameter, $info)) {
if (Type::BUILTIN_TYPE_ARRAY === $info[1]) {
@@ -191,7 +193,7 @@ private function extractFromMutator($class, $property)
$type = new Type(Type::BUILTIN_TYPE_OBJECT, $reflectionParameter->allowsNull(), $this->resolveTypeName($info[1], $reflectionMethod));
}
} else {
- return;
+ return null;
}
if (\in_array($prefix, $this->arrayMutatorPrefixes)) {
@@ -213,16 +215,14 @@ private function extractFromAccessor($class, $property)
{
list($reflectionMethod, $prefix) = $this->getAccessorMethod($class, $property);
if (null === $reflectionMethod) {
- return;
+ return null;
}
if ($this->supportsParameterType && $reflectionType = $reflectionMethod->getReturnType()) {
return [$this->extractFromReflectionType($reflectionType, $reflectionMethod)];
}
- if (\in_array($prefix, ['is', 'can'])) {
- return [new Type(Type::BUILTIN_TYPE_BOOL)];
- }
+ return \in_array($prefix, ['is', 'can']) ? [new Type(Type::BUILTIN_TYPE_BOOL)] : null;
}
/**
@@ -310,6 +310,8 @@ private function getAccessorMethod($class, $property)
// Return null if the property doesn't exist
}
}
+
+ return null;
}
/**
@@ -321,7 +323,7 @@ private function getAccessorMethod($class, $property)
* @param string $class
* @param string $property
*
- * @return array
+ * @return array|null
*/
private function getMutatorMethod($class, $property)
{
@@ -350,6 +352,8 @@ private function getMutatorMethod($class, $property)
}
}
}
+
+ return null;
}
/**
@@ -358,7 +362,7 @@ private function getMutatorMethod($class, $property)
* @param string $methodName
* @param \ReflectionProperty[] $reflectionProperties
*
- * @return string
+ * @return string|null
*/
private function getPropertyName($methodName, array $reflectionProperties)
{
@@ -379,5 +383,7 @@ private function getPropertyName($methodName, array $reflectionProperties)
return $matches[2];
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php
index bb6482ff7bb62..5678cae72338f 100644
--- a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php
+++ b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php
@@ -103,5 +103,7 @@ private function extract($extractors, $method, array $arguments)
return $value;
}
}
+
+ return null;
}
}
diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php
index 3a826d86f60a9..42c6349227556 100644
--- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php
+++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php
@@ -123,6 +123,8 @@ public function generate($name, $parameters = [], $referenceType = self::ABSOLUT
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
* it does not match the requirement
+ *
+ * @return string|null
*/
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
{
@@ -150,7 +152,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
$this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]);
}
- return;
+ return null;
}
$url = $token[1].$mergedParams[$token[3]].$url;
@@ -205,7 +207,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
$this->logger->error($message, ['parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]]);
}
- return;
+ return null;
}
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost;
diff --git a/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php
index 64714d354dba2..beb73324cac89 100644
--- a/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php
+++ b/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php
@@ -75,7 +75,7 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
* @param mixed[] $parameters An array of parameters
* @param int $referenceType The type of reference to be generated (one of the constants)
*
- * @return string The generated URL
+ * @return string|null The generated URL
*
* @throws RouteNotFoundException If the named route doesn't exist
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php b/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php
index 15c47051f5b60..c8497c36fa558 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php
@@ -114,7 +114,7 @@ private function groupWithItem($item, $prefix, $route)
$commonPrefix = $this->detectCommonPrefix($prefix, $itemPrefix);
if (!$commonPrefix) {
- return;
+ return null;
}
$child = new self($commonPrefix);
diff --git a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
index 3c3c4bfcf919e..b4c655c667b86 100644
--- a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
+++ b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php
@@ -127,6 +127,8 @@ protected function matchCollection($pathinfo, RouteCollection $routes)
return true;
}
+
+ return [];
}
private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null)
diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
index d107721471533..b1259d116f641 100644
--- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
@@ -90,11 +90,21 @@ public function onKernelException(GetResponseForExceptionEvent $event)
$exception = $event->getException();
do {
if ($exception instanceof AuthenticationException) {
- return $this->handleAuthenticationException($event, $exception);
- } elseif ($exception instanceof AccessDeniedException) {
- return $this->handleAccessDeniedException($event, $exception);
- } elseif ($exception instanceof LogoutException) {
- return $this->handleLogoutException($exception);
+ $this->handleAuthenticationException($event, $exception);
+
+ return;
+ }
+
+ if ($exception instanceof AccessDeniedException) {
+ $this->handleAccessDeniedException($event, $exception);
+
+ return;
+ }
+
+ if ($exception instanceof LogoutException) {
+ $this->handleLogoutException($exception);
+
+ return;
}
} while (null !== $exception = $exception->getPrevious());
}
diff --git a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php
index fe830b252f90a..e366c47a3e27e 100644
--- a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php
@@ -135,6 +135,9 @@ public function handle(GetResponseEvent $event)
$event->setResponse($response);
}
+ /**
+ * @return Response|null
+ */
private function onSuccess(Request $request, TokenInterface $token)
{
if (null !== $this->logger) {
@@ -151,7 +154,7 @@ private function onSuccess(Request $request, TokenInterface $token)
}
if (!$this->successHandler) {
- return; // let the original request succeeds
+ return null; // let the original request succeeds
}
$response = $this->successHandler->onAuthenticationSuccess($request, $token);
diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php
index 8be684df9ddfc..8dacdafb574d1 100644
--- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php
+++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php
@@ -148,6 +148,8 @@ final public function autoLogin(Request $request)
throw $e;
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
index 489ac49a0514f..f2fb082b4b023 100644
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
@@ -241,7 +241,7 @@ private function validateAndDenormalize($currentClass, $attribute, $data, $forma
$expectedTypes = [];
foreach ($types as $type) {
if (null === $data && $type->isNullable()) {
- return;
+ return null;
}
if ($type->isCollection() && null !== ($collectionValueType = $type->getCollectionValueType()) && Type::BUILTIN_TYPE_OBJECT === $collectionValueType->getBuiltinType()) {
diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
index 7742da7bc0828..07c5a318afd99 100644
--- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
@@ -138,6 +138,8 @@ protected function getAttributeValue($object, $attribute, $format = null, array
if (\is_callable([$object, $haser])) {
return $object->$haser();
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
index 84047e82c6483..46faa1e7e9dfd 100644
--- a/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/PropertyNormalizer.php
@@ -121,7 +121,7 @@ protected function getAttributeValue($object, $attribute, $format = null, array
try {
$reflectionProperty = $this->getReflectionProperty($object, $attribute);
} catch (\ReflectionException $reflectionException) {
- return;
+ return null;
}
// Override visibility
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
index a6807c79bfb58..f1eafe811f9f3 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
@@ -250,6 +250,8 @@ public function denormalize($data, $type, $format = null, array $context = [])
return $normalizer->denormalize($data, $type, $format, $context);
}
}
+
+ return null;
}
public function supportsDenormalization($data, $type, $format = null)
diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php
index 89a4e50e21fa3..922e026c483c8 100644
--- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php
+++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php
@@ -201,10 +201,13 @@ private function getFiles($fileOrDirectory)
}
}
+ /**
+ * @return string|null
+ */
private function getStdin()
{
if (0 !== ftell(STDIN)) {
- return;
+ return null;
}
$inputs = '';
diff --git a/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php b/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php
index 48d0befdf9412..9047a3b760523 100644
--- a/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php
+++ b/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php
@@ -86,9 +86,7 @@ private function writePadding($data)
{
$padding = \strlen($data) % 4;
- if ($padding) {
- return str_repeat("\xAA", 4 - $padding);
- }
+ return $padding ? str_repeat("\xAA", 4 - $padding) : null;
}
private function getPosition($data)
diff --git a/src/Symfony/Component/Translation/MessageCatalogue.php b/src/Symfony/Component/Translation/MessageCatalogue.php
index 73fdcfdc829f4..9b59c87d2f919 100644
--- a/src/Symfony/Component/Translation/MessageCatalogue.php
+++ b/src/Symfony/Component/Translation/MessageCatalogue.php
@@ -231,6 +231,8 @@ public function getMetadata($key = '', $domain = 'messages')
return $this->metadata[$domain][$key];
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
index e5c3fd5ea619e..7e9934d133a24 100644
--- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
+++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php
@@ -112,5 +112,6 @@ abstract protected function compareValues($value1, $value2);
*/
protected function getErrorCode()
{
+ return null;
}
}
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
index 00925ddfdfa1b..cb10c061643c8 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php
@@ -244,5 +244,6 @@ abstract protected function createConstraint(array $options = null);
*/
protected function getErrorCode()
{
+ return null;
}
}
diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php
index 0909c04cd2c65..d14c5aa00ba7a 100644
--- a/src/Symfony/Component/VarDumper/Cloner/Data.php
+++ b/src/Symfony/Component/VarDumper/Cloner/Data.php
@@ -34,7 +34,7 @@ public function __construct(array $data)
}
/**
- * @return string The type of the value
+ * @return string|null The type of the value
*/
public function getType()
{
@@ -58,6 +58,8 @@ public function getType()
if (Stub::TYPE_RESOURCE === $item->type) {
return $item->class.' resource';
}
+
+ return null;
}
/**
@@ -127,6 +129,8 @@ public function __get($key)
return $item instanceof Stub || [] === $item ? $data : $item;
}
+
+ return null;
}
public function __isset($key)
diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php
index 1713e30355250..4eb8e6f0c1b6d 100644
--- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php
+++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php
@@ -154,6 +154,8 @@ public function dump(Data $data, $output = null)
setlocale(LC_NUMERIC, $locale);
}
}
+
+ return null;
}
/**
diff --git a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php
index aae113b6c5f9e..84c36f49cbd54 100644
--- a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php
+++ b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php
@@ -41,6 +41,9 @@ public function assertDumpMatchesFormat($dump, $data, $filter = 0, $message = ''
$this->assertStringMatchesFormat(rtrim($dump), $this->getDump($data, null, $filter), $message);
}
+ /**
+ * @return string|null
+ */
protected function getDump($data, $key = null, $filter = 0)
{
$flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
@@ -52,7 +55,7 @@ protected function getDump($data, $key = null, $filter = 0)
$dumper->setColors(false);
$data = $cloner->cloneVar($data, $filter)->withRefHandles(false);
if (null !== $key && null === $data = $data->seek($key)) {
- return;
+ return null;
}
return rtrim($dumper->dump($data, true));
diff --git a/src/Symfony/Component/Yaml/Command/LintCommand.php b/src/Symfony/Component/Yaml/Command/LintCommand.php
index cc19a5658101d..f6732ecf8df60 100644
--- a/src/Symfony/Component/Yaml/Command/LintCommand.php
+++ b/src/Symfony/Component/Yaml/Command/LintCommand.php
@@ -196,10 +196,13 @@ private function getFiles($fileOrDirectory)
}
}
+ /**
+ * @return string|null
+ */
private function getStdin()
{
if (0 !== ftell(STDIN)) {
- return;
+ return null;
}
$inputs = '';
diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php
index 5d71a1f30f08c..10fa2702e851c 100644
--- a/src/Symfony/Component/Yaml/Inline.php
+++ b/src/Symfony/Component/Yaml/Inline.php
@@ -644,7 +644,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
case 'null' === $scalarLower:
case '' === $scalar:
case '~' === $scalar:
- return;
+ return null;
case 'true' === $scalarLower:
return true;
case 'false' === $scalarLower:
@@ -672,7 +672,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return;
+ return null;
case 0 === strpos($scalar, '!!php/object:'):
if (self::$objectSupport) {
@trigger_error(self::getDeprecationMessage('The !!php/object: tag to indicate dumped PHP objects is deprecated since Symfony 3.1 and will be removed in 4.0. Use the !php/object (without the colon) tag instead.'), E_USER_DEPRECATED);
@@ -684,7 +684,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return;
+ return null;
case 0 === strpos($scalar, '!php/object'):
if (self::$objectSupport) {
return unserialize(self::parseScalar(substr($scalar, 12)));
@@ -694,7 +694,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return;
+ return null;
case 0 === strpos($scalar, '!php/const:'):
if (self::$constantSupport) {
@trigger_error(self::getDeprecationMessage('The !php/const: tag to indicate dumped PHP constants is deprecated since Symfony 3.4 and will be removed in 4.0. Use the !php/const (without the colon) tag instead.'), E_USER_DEPRECATED);
@@ -709,7 +709,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return;
+ return null;
case 0 === strpos($scalar, '!php/const'):
if (self::$constantSupport) {
$i = 0;
@@ -723,7 +723,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Have you forgotten to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
- return;
+ return null;
case 0 === strpos($scalar, '!!float '):
return (float) substr($scalar, 8);
case 0 === strpos($scalar, '!!binary '):
@@ -795,7 +795,7 @@ private static function evaluateScalar($scalar, $flags, $references = [])
private static function parseTag($value, &$i, $flags)
{
if ('!' !== $value[$i]) {
- return;
+ return null;
}
$tagLength = strcspn($value, " \t\n", $i + 1);
@@ -807,7 +807,7 @@ private static function parseTag($value, &$i, $flags)
// Is followed by a scalar
if ((!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && 'tagged' !== $tag) {
// Manage non-whitelisted scalars in {@link self::evaluateScalar()}
- return;
+ return null;
}
// Built-in tags
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index 013810df7a25e..7d6112e3b9c6f 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -564,7 +564,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
$oldLineIndentation = $this->getCurrentLineIndentation();
if (!$this->moveToNextLine()) {
- return;
+ return '';
}
if (null === $indentation) {
@@ -607,7 +607,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
} else {
$this->moveToPreviousLine();
- return;
+ return '';
}
if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) {
@@ -615,7 +615,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
// and therefore no nested list or mapping
$this->moveToPreviousLine();
- return;
+ return '';
}
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
@@ -1102,14 +1102,17 @@ private function trimTag($value)
return $value;
}
+ /**
+ * @return string|null
+ */
private function getLineTag($value, $flags, $nextLineCheck = true)
{
if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) {
- return;
+ return null;
}
if ($nextLineCheck && !$this->isNextLineIndented()) {
- return;
+ return null;
}
$tag = substr($matches['tag'], 1);
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 316f31b1cd9b4..c48f0b4f4546b 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -49,6 +49,8 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated)
}
$deprecations[] = $msg;
+
+ return null;
});
}