diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php index 3509d9b03b..bcba6a4b7e 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php @@ -91,7 +91,7 @@ class IdReader public function getIdValue($object) { if (!$object) { - return; + return null; } if (!$this->om->contains($object)) { diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php index 34fb04aed2..4d444cd2b9 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php @@ -99,7 +99,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface $classMetadatas = $this->getMetadata($class); if (!$classMetadatas) { - return; + return null; } /** @var ClassMetadataInfo $classMetadata */ diff --git a/src/Symfony/Bridge/Twig/AppVariable.php b/src/Symfony/Bridge/Twig/AppVariable.php index 21020270a0..e1f0ed4c38 100644 --- a/src/Symfony/Bridge/Twig/AppVariable.php +++ b/src/Symfony/Bridge/Twig/AppVariable.php @@ -68,7 +68,7 @@ class AppVariable /** * Returns the current user. * - * @return mixed + * @return object|null * * @see TokenInterface::getUser() */ @@ -79,7 +79,7 @@ class AppVariable } if (!$token = $tokenStorage->getToken()) { - return; + return null; } $user = $token->getUser(); diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 0766b4597a..97b8dfa3cc 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -22,6 +22,7 @@ }, "require-dev": { "egulias/email-validator": "^2.0", + "fig/link-util": "^1.0", "symfony/asset": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", "symfony/finder": "~3.4|~4.0", diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php index 2f20678e31..b9d4bf84a5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php @@ -351,7 +351,7 @@ trait ControllerTrait /** * Get a user from the Security Token Storage. * - * @return mixed + * @return object|null * * @throws \LogicException If SecurityBundle is not available * @@ -366,12 +366,12 @@ trait ControllerTrait } if (null === $token = $this->container->get('security.token_storage')->getToken()) { - return; + return null; } if (!\is_object($user = $token->getUser())) { // e.g. anonymous authentication - return; + return null; } return $user; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php index 2981eb6642..8c00001314 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.php @@ -40,7 +40,7 @@ class GlobalVariables public function getToken() { if (!$this->container->has('security.token_storage')) { - return; + return null; } return $this->container->get('security.token_storage')->getToken(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index adca7e5625..204d6dea11 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -126,7 +126,7 @@ class CodeHelper extends Helper // Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) { - return; + return ''; } } diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index f7d0c36b5b..aeea4d90d3 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -533,7 +533,7 @@ abstract class Client protected function createCrawlerFromContent($uri, $content, $type) { if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { - return; + return null; } $crawler = new Crawler(null, $uri); diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index dd9ead6269..c32bef9d94 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -219,7 +219,7 @@ class XmlUtils switch (true) { case 'null' === $lowercaseValue: - return; + return null; case ctype_digit($value): $raw = $value; $cast = (int) $value; diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index da1158528e..c8787d8592 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -472,7 +472,7 @@ class Application if (!$command->isEnabled()) { $command->setApplication(null); - return; + return null; } if (null === $command->getDefinition()) { diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index 843e330b52..001bfe1a76 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -155,7 +155,7 @@ class TokenStream } if ($next->isDelimiter(['*'])) { - return; + return null; } throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index b8cd32629c..7bdcaac629 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -443,7 +443,7 @@ class ErrorHandler self::$silencedErrorCache[$id][$message] = $errorAsException; } if (null === $lightTrace) { - return; + return true; } } else { $errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line); diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index a0e2f770f0..29d49c1c3b 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -33,11 +33,11 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface $notFoundSuffix = '\' not found'; $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { - return; + return null; } if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; + return null; } foreach (['class', 'interface', 'trait'] as $typeName) { diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php index 9eddeba5a6..77fc7aa261 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php @@ -30,17 +30,17 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface $notFoundSuffix = '()'; $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { - return; + return null; } if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; + return null; } $prefix = 'Call to undefined function '; $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { - return; + return null; } $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 1318cb13ba..ff2843b681 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -28,7 +28,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface { preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches); if (!$matches) { - return; + return null; } $className = $matches[1]; diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php index 65e432d93c..257e09b391 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php @@ -29,7 +29,7 @@ class ProxyHelper $type = $r->getReturnType(); } if (!$type) { - return; + return null; } if (!\is_string($type)) { $name = $type->getName(); @@ -45,7 +45,7 @@ class ProxyHelper return $prefix.$name; } if (!$r instanceof \ReflectionMethod) { - return; + return null; } if ('self' === $lcName) { return $prefix.$r->getDeclaringClass()->name; diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 8f5c852229..3dc29bf842 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -414,12 +414,12 @@ class Filesystem public function readlink($path, $canonicalize = false) { if (!$canonicalize && !is_link($path)) { - return; + return null; } if ($canonicalize) { if (!$this->exists($path)) { - return; + return null; } if ('\\' === \DIRECTORY_SEPARATOR) { diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php index ac6c3bcfa3..04e414df5a 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php @@ -78,14 +78,11 @@ interface ChoiceListFactoryInterface * attributes that should be added to the respective choice. * * @param array|callable|null $preferredChoices The preferred choices - * @param callable|null $label The callable generating the - * choice labels - * @param callable|null $index The callable generating the - * view indices - * @param callable|null $groupBy The callable generating the - * group names - * @param array|callable|null $attr The callable generating the - * HTML attributes + * @param callable|false|null $label The callable generating the choice labels; + * pass false to discard the label + * @param callable|null $index The callable generating the view indices + * @param callable|null $groupBy The callable generating the group names + * @param array|callable|null $attr The callable generating the HTML attributes * * @return ChoiceListView The choice list view */ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php index dca727faee..aec9c2396e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php @@ -45,14 +45,14 @@ class BooleanToStringTransformer implements DataTransformerInterface * * @param bool $value Boolean value * - * @return string String value + * @return string|null String value * * @throws TransformationFailedException if the given value is not a Boolean */ public function transform($value) { if (null === $value) { - return; + return null; } if (!\is_bool($value)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php index 75e06833ef..48fe6c1bf0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php @@ -106,7 +106,7 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface * * @param array $value Interval array * - * @return \DateInterval Normalized date interval + * @return \DateInterval|null Normalized date interval * * @throws UnexpectedTypeException if the given value is not an array * @throws TransformationFailedException if the value could not be transformed @@ -114,13 +114,13 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface public function reverseTransform($value) { if (null === $value) { - return; + return null; } if (!\is_array($value)) { throw new UnexpectedTypeException($value, 'array'); } if ('' === implode('', $value)) { - return; + return null; } $emptyFields = []; foreach ($this->fields as $field) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php index 1e80dd68f7..773df4ea7a 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToStringTransformer.php @@ -62,7 +62,7 @@ class DateIntervalToStringTransformer implements DataTransformerInterface * * @param string $value An ISO 8601 or date string like date interval presentation * - * @return \DateInterval An instance of \DateInterval + * @return \DateInterval|null An instance of \DateInterval * * @throws UnexpectedTypeException if the given value is not a string * @throws TransformationFailedException if the date interval could not be parsed @@ -70,13 +70,13 @@ class DateIntervalToStringTransformer implements DataTransformerInterface public function reverseTransform($value) { if (null === $value) { - return; + return null; } if (!\is_string($value)) { throw new UnexpectedTypeException($value, 'string'); } if ('' === $value) { - return; + return null; } if (!$this->isISO8601($value)) { throw new TransformationFailedException('Non ISO 8601 date strings are not supported yet'); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php index 00600f8487..a0b6007337 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -103,7 +103,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer * * @param array $value Localized date * - * @return \DateTime Normalized date + * @return \DateTime|null Normalized date * * @throws TransformationFailedException If the given value is not an array, * if the value could not be transformed @@ -111,7 +111,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer public function reverseTransform($value) { if (null === $value) { - return; + return null; } if (!\is_array($value)) { @@ -119,7 +119,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer } if ('' === implode('', $value)) { - return; + return null; } $emptyFields = []; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php index 280e4d4293..f7f113b9d8 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php @@ -66,7 +66,7 @@ class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer * * @param string $dateTimeLocal Formatted string * - * @return \DateTime Normalized date + * @return \DateTime|null Normalized date * * @throws TransformationFailedException If the given value is not a string, * if the value could not be transformed @@ -78,7 +78,7 @@ class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer } if ('' === $dateTimeLocal) { - return; + return null; } // to maintain backwards compatibility we do not strictly validate the submitted date diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index fde557b0cc..325f61f112 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -99,7 +99,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer * * @param string|array $value Localized date string/array * - * @return \DateTime Normalized date + * @return \DateTime|null Normalized date * * @throws TransformationFailedException if the given value is not a string, * if the date could not be parsed @@ -111,7 +111,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer } if ('' === $value) { - return; + return null; } // date-only patterns require parsing to be done in UTC, as midnight might not exist in the local timezone due diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php index 1838113f9d..a3437b895f 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -53,7 +53,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer * * @param string $rfc3339 Formatted string * - * @return \DateTime Normalized date + * @return \DateTime|null Normalized date * * @throws TransformationFailedException If the given value is not a string, * if the value could not be transformed @@ -65,7 +65,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer } if ('' === $rfc3339) { - return; + return null; } if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php index 866bdb3c8b..d27a8ff6c4 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -101,7 +101,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer * * @param string $value A value as produced by PHP's date() function * - * @return \DateTime An instance of \DateTime + * @return \DateTime|null An instance of \DateTime * * @throws TransformationFailedException If the given value is not a string, * or could not be transformed @@ -109,7 +109,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer public function reverseTransform($value) { if (empty($value)) { - return; + return null; } if (!\is_string($value)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php index d6091589c4..5a52038650 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php @@ -26,14 +26,14 @@ class DateTimeToTimestampTransformer extends BaseDateTimeTransformer * * @param \DateTimeInterface $dateTime A DateTimeInterface object * - * @return int A timestamp + * @return int|null A timestamp * * @throws TransformationFailedException If the given value is not a \DateTimeInterface */ public function transform($dateTime) { if (null === $dateTime) { - return; + return null; } if (!$dateTime instanceof \DateTimeInterface) { @@ -48,7 +48,7 @@ class DateTimeToTimestampTransformer extends BaseDateTimeTransformer * * @param string $value A timestamp * - * @return \DateTime A \DateTime object + * @return \DateTime|null A \DateTime object * * @throws TransformationFailedException If the given value is not a timestamp * or if the given timestamp is invalid @@ -56,7 +56,7 @@ class DateTimeToTimestampTransformer extends BaseDateTimeTransformer public function reverseTransform($value) { if (null === $value) { - return; + return null; } if (!is_numeric($value)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index a93a9bf246..8e0e1454e0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -145,7 +145,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface } if ('' === $value) { - return; + return null; } if (\in_array($value, ['NaN', 'NAN', 'nan'], true)) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index 9ec387479b..4ead932927 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -112,7 +112,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface } if ('' === $value) { - return; + return null; } $position = 0; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index 72e34f4544..c1944cb9bf 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -74,7 +74,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface if (\count($emptyKeys) > 0) { if (\count($emptyKeys) == \count($this->keys)) { // All keys 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/Validator/ViolationMapper/ViolationPath.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php index 37570b7753..343cd6dae6 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php @@ -134,7 +134,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface public function getParent() { if ($this->length <= 1) { - return; + return null; } $parent = clone $this; diff --git a/src/Symfony/Component/Form/Util/ServerParams.php b/src/Symfony/Component/Form/Util/ServerParams.php index 57b54a9c6e..08b9d690c7 100644 --- a/src/Symfony/Component/Form/Util/ServerParams.php +++ b/src/Symfony/Component/Form/Util/ServerParams.php @@ -48,7 +48,7 @@ class ServerParams $iniMax = strtolower($this->getNormalizedIniPostMaxSize()); if ('' === $iniMax) { - return; + return null; } $max = ltrim($iniMax, '+'); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index b4d51023cb..9633f0174e 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -79,7 +79,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface } if (!self::isSupported()) { - return; + return null; } ob_start(); @@ -89,14 +89,14 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface if ($return > 0) { ob_end_clean(); - return; + return null; } $type = trim(ob_get_clean()); if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { // it's not a type, but an error message - return; + return null; } return $match[1]; diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 4f88550761..70a01d7aec 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -62,11 +62,11 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface } if (!self::isSupported()) { - return; + return null; } if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { - return; + return null; } return $finfo->file($path); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 0f048b5332..eab444890e 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -29,7 +29,7 @@ interface MimeTypeGuesserInterface * * @param string $path The path to the file * - * @return string The mime type or NULL, if none could be guessed + * @return string|null The mime type or NULL, if none could be guessed * * @throws FileNotFoundException If the file does not exist * @throws AccessDeniedException If the file could not be read diff --git a/src/Symfony/Component/HttpFoundation/RequestStack.php b/src/Symfony/Component/HttpFoundation/RequestStack.php index 885d78a50e..244a77d631 100644 --- a/src/Symfony/Component/HttpFoundation/RequestStack.php +++ b/src/Symfony/Component/HttpFoundation/RequestStack.php @@ -47,7 +47,7 @@ class RequestStack public function pop() { if (!$this->requests) { - return; + return null; } return array_pop($this->requests); @@ -73,7 +73,7 @@ class RequestStack public function getMasterRequest() { if (!$this->requests) { - return; + return null; } return $this->requests[0]; @@ -95,7 +95,7 @@ class RequestStack $pos = \count($this->requests) - 2; if (!isset($this->requests[$pos])) { - return; + return null; } return $this->requests[$pos]; diff --git a/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php index c466fb7c9e..019ccee49f 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/SessionListener.php @@ -35,7 +35,7 @@ class SessionListener extends AbstractSessionListener protected function getSession() { if (!$this->container->has('session')) { - return; + return null; } if ($this->container->has('session_storage') diff --git a/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php index 46323ae2a8..a0a52c2a75 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/TestSessionListener.php @@ -33,7 +33,7 @@ class TestSessionListener extends AbstractTestSessionListener protected function getSession() { if (!$this->container->has('session')) { - return; + return null; } return $this->container->get('session'); diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 863998fd31..541187cfec 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -116,7 +116,7 @@ class FileProfilerStorage implements ProfilerStorageInterface public function read($token) { if (!$token || !file_exists($file = $this->getFilename($token))) { - return; + return null; } return $this->createProfileFromData($token, unserialize(file_get_contents($file))); @@ -227,7 +227,7 @@ class FileProfilerStorage implements ProfilerStorageInterface $position = ftell($file); if (0 === $position) { - return; + return null; } while (true) { diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php index a31640feeb..d0e016e767 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -143,7 +143,7 @@ class Profiler implements ResetInterface public function collect(Request $request, Response $response, \Exception $exception = null) { if (false === $this->enabled) { - return; + return null; } $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6)); diff --git a/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php index b78bae847f..c97e640b60 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ b/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php @@ -47,7 +47,7 @@ interface ProfilerStorageInterface * * @param string $token A token * - * @return Profile The profile associated with token + * @return Profile|null The profile associated with token */ public function read($token); diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index eda413a12b..f62591b968 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -79,7 +79,7 @@ class LocaleDataGenerator extends AbstractDataGenerator // Don't generate aliases, as they are resolved during runtime // Unless an alias is needed as fallback for de-duplication purposes if (isset($this->localeAliases[$displayLocale]) && !$this->generatingFallback) { - return; + return null; } // Generate locale names for all locales that have translations in @@ -124,7 +124,7 @@ class LocaleDataGenerator extends AbstractDataGenerator $data['Names'] = array_diff($data['Names'], $fallbackData['Names']); } if (!$data['Names']) { - return; + return null; } return $data; diff --git a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php index b7ea33ea58..0b779f5db3 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php @@ -42,7 +42,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter try { return $this->getSymbol($currency, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } @@ -54,7 +54,7 @@ class CurrencyBundle extends CurrencyDataProvider implements CurrencyBundleInter try { return $this->getName($currency, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php b/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php index eabd94821d..077fbafc0a 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php @@ -54,7 +54,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter try { return $this->getName($language, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } @@ -78,7 +78,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter try { return $this->scriptProvider->getName($script, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php b/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php index 19acc41782..41d856fa48 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php @@ -43,7 +43,7 @@ class LocaleBundle extends LocaleDataProvider implements LocaleBundleInterface try { return $this->getName($locale, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } diff --git a/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php b/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php index 4cb34c2a09..8ec854e694 100644 --- a/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php +++ b/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php @@ -42,7 +42,7 @@ class RegionBundle extends RegionDataProvider implements RegionBundleInterface try { return $this->getName($country, $displayLocale); } catch (MissingResourceException $e) { - return; + return null; } } diff --git a/src/Symfony/Component/Intl/Util/Version.php b/src/Symfony/Component/Intl/Util/Version.php index d24c3bae1b..e12a362c0a 100644 --- a/src/Symfony/Component/Intl/Util/Version.php +++ b/src/Symfony/Component/Intl/Util/Version.php @@ -83,7 +83,7 @@ class Version } if (!preg_match('/^'.$pattern.'/', $version, $matches)) { - return; + return null; } return $matches[0]; diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 35f72b06d2..f32cfb941e 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -753,7 +753,7 @@ class Process implements \IteratorAggregate public function getExitCodeText() { if (null === $exitcode = $this->getExitCode()) { - return; + return null; } return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error'; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPath.php b/src/Symfony/Component/PropertyAccess/PropertyPath.php index cb7d4ced85..899cf55df8 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPath.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPath.php @@ -136,7 +136,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface public function getParent() { if ($this->length <= 1) { - return; + return null; } $parent = clone $this; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php b/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php index b627ebc416..ecaffac79a 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathInterface.php @@ -40,7 +40,7 @@ interface PropertyPathInterface extends \Traversable * * If this property path only contains one item, null is returned. * - * @return PropertyPath The parent path or null + * @return PropertyPath|null The parent path or null */ public function getParent(); diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index 4837d2200c..8944f37a50 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -73,7 +73,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property /** @var $docBlock DocBlock */ list($docBlock) = $this->getDocBlock($class, $property); if (!$docBlock) { - return; + return null; } $shortDescription = $docBlock->getSummary(); @@ -99,7 +99,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property /** @var $docBlock DocBlock */ list($docBlock) = $this->getDocBlock($class, $property); if (!$docBlock) { - return; + return null; } $contents = $docBlock->getDescription()->render(); @@ -115,7 +115,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property /** @var $docBlock DocBlock */ list($docBlock, $source, $prefix) = $this->getDocBlock($class, $property); if (!$docBlock) { - return; + return null; } switch ($source) { @@ -141,7 +141,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property } if (!isset($types[0])) { - return; + return null; } if (!\in_array($prefix, $this->arrayMutatorPrefixes)) { diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index c56dbdc2cb..78e517d1d5 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -80,7 +80,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp try { $reflectionClass = new \ReflectionClass($class); } catch (\ReflectionException $e) { - return; + return null; } $propertyFlags = 0; diff --git a/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php index 98d75f0a93..3a67704e51 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php @@ -36,11 +36,11 @@ class SerializerExtractor implements PropertyListExtractorInterface public function getProperties($class, array $context = []) { if (!isset($context['serializer_groups']) || !\is_array($context['serializer_groups'])) { - return; + return null; } if (!$this->classMetadataFactory->getMetadataFor($class)) { - return; + return null; } $properties = []; diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index a096574969..eafd614d4f 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -46,7 +46,7 @@ class AnnotationFileLoader extends FileLoader * @param string $file A PHP file path * @param string|null $type The resource type * - * @return RouteCollection A RouteCollection instance + * @return RouteCollection|null A RouteCollection instance * * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed */ @@ -58,7 +58,7 @@ class AnnotationFileLoader extends FileLoader if ($class = $this->findClass($path)) { $refl = new \ReflectionClass($class); if ($refl->isAbstract()) { - return; + return null; } $collection->addResource(new FileResource($path)); diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php index aa59240be0..62b0e7c9c4 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php @@ -88,7 +88,7 @@ class NativeSessionTokenStorage implements ClearableTokenStorageInterface } if (!isset($_SESSION[$this->namespace][$tokenId])) { - return; + return null; } $token = (string) $_SESSION[$this->namespace][$tokenId]; diff --git a/src/Symfony/Component/Security/Http/ParameterBagUtils.php b/src/Symfony/Component/Security/Http/ParameterBagUtils.php index eed5421f8f..a8d47c5a47 100644 --- a/src/Symfony/Component/Security/Http/ParameterBagUtils.php +++ b/src/Symfony/Component/Security/Http/ParameterBagUtils.php @@ -45,7 +45,7 @@ final class ParameterBagUtils $root = substr($path, 0, $pos); if (null === $value = $parameters->get($root)) { - return; + return null; } if (null === self::$propertyAccessor) { @@ -55,7 +55,7 @@ final class ParameterBagUtils try { return self::$propertyAccessor->getValue($value, substr($path, $pos)); } catch (AccessException $e) { - return; + return null; } } @@ -80,7 +80,7 @@ final class ParameterBagUtils $root = substr($path, 0, $pos); if (null === $value = $request->get($root)) { - return; + return null; } if (null === self::$propertyAccessor) { @@ -90,7 +90,7 @@ final class ParameterBagUtils try { return self::$propertyAccessor->getValue($value, substr($path, $pos)); } catch (AccessException $e) { - return; + return null; } } } diff --git a/src/Symfony/Component/Validator/Constraints/Regex.php b/src/Symfony/Component/Validator/Constraints/Regex.php index c621bcbdc3..87601cd433 100644 --- a/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/src/Symfony/Component/Validator/Constraints/Regex.php @@ -82,7 +82,7 @@ class Regex extends Constraint // Quit if delimiters not at very beginning/end (e.g. when options are passed) if ($this->pattern[0] !== $this->pattern[\strlen($this->pattern) - 1]) { - return; + return null; } $delimiter = $this->pattern[0]; diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index 838aeb0c6a..adf1a6c1a3 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -223,7 +223,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate $item = $item->value; } if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) { - return; + return null; } $keys = [$key]; @@ -238,7 +238,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate case Stub::TYPE_RESOURCE: break; default: - return; + return null; } $data = null;