unified return null usages

This commit is contained in:
Fabien Potencier 2014-04-16 09:15:58 +02:00
parent d56ea768cc
commit d1d569bf7b
85 changed files with 79 additions and 162 deletions

View File

@ -291,8 +291,6 @@ abstract class AbstractDoctrineExtension extends Extension
if (is_dir($dir.'/'.$this->getMappingObjectDefaultName())) { if (is_dir($dir.'/'.$this->getMappingObjectDefaultName())) {
return 'annotation'; return 'annotation';
} }
return null;
} }
/** /**

View File

@ -88,7 +88,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
$classMetadatas = $this->getMetadata($class); $classMetadatas = $this->getMetadata($class);
if (!$classMetadatas) { if (!$classMetadatas) {
return null; return;
} }
/* @var ClassMetadataInfo $classMetadata */ /* @var ClassMetadataInfo $classMetadata */
@ -116,8 +116,6 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE); return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
} }
return null;
} }
/** /**

View File

@ -69,8 +69,6 @@ abstract class DoctrineType extends AbstractType
if (null !== $options['query_builder']) { if (null !== $options['query_builder']) {
return $type->getLoader($options['em'], $options['query_builder'], $options['class']); return $type->getLoader($options['em'], $options['query_builder'], $options['class']);
} }
return null;
}; };
$choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) { $choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) {

View File

@ -66,8 +66,6 @@ class ItemQuery
if ($this->hasColumn($column)) { if ($this->hasColumn($column)) {
return new Column($column, $this->map[$column]); return new Column($column, $this->map[$column]);
} }
return null;
} }
/** /**

View File

@ -111,7 +111,7 @@ class TranslationNodeVisitor implements \Twig_NodeVisitorInterface
} elseif ($arguments->hasNode($index)) { } elseif ($arguments->hasNode($index)) {
$argument = $arguments->getNode($index); $argument = $arguments->getNode($index);
} else { } else {
return null; return;
} }
return $this->getReadDomainFromNode($argument); return $this->getReadDomainFromNode($argument);
@ -125,7 +125,7 @@ class TranslationNodeVisitor implements \Twig_NodeVisitorInterface
private function getReadDomainFromNode(\Twig_Node $node = null) private function getReadDomainFromNode(\Twig_Node $node = null)
{ {
if (null === $node) { if (null === $node) {
return null; return;
} }
if ($node instanceof \Twig_Node_Expression_Constant) { if ($node instanceof \Twig_Node_Expression_Constant) {

View File

@ -218,11 +218,11 @@ class Controller extends ContainerAware
} }
if (null === $token = $this->container->get('security.context')->getToken()) { if (null === $token = $this->container->get('security.context')->getToken()) {
return null; return;
} }
if (!is_object($user = $token->getUser())) { if (!is_object($user = $token->getUser())) {
return null; return;
} }
return $user; return $user;

View File

@ -441,7 +441,7 @@ abstract class Client
protected function createCrawlerFromContent($uri, $content, $type) protected function createCrawlerFromContent($uri, $content, $type)
{ {
if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { if (!class_exists('Symfony\Component\DomCrawler\Crawler')) {
return null; return;
} }
$crawler = new Crawler(null, $uri); $crawler = new Crawler(null, $uri);

View File

@ -73,7 +73,7 @@ class CookieJar
} }
} }
return null; return;
} }
// avoid relying on this behavior that is mainly here for BC reasons // avoid relying on this behavior that is mainly here for BC reasons
@ -82,8 +82,6 @@ class CookieJar
return $cookies[$path][$name]; return $cookies[$path][$name];
} }
} }
return null;
} }
/** /**

View File

@ -186,7 +186,7 @@ class XmlUtils
switch (true) { switch (true) {
case 'null' === $lowercaseValue: case 'null' === $lowercaseValue:
return null; return;
case ctype_digit($value): case ctype_digit($value):
$raw = $value; $raw = $value;
$cast = intval($value); $cast = intval($value);

View File

@ -162,7 +162,7 @@ class TokenStream
} }
if ($next->isDelimiter(array('*'))) { if ($next->isDelimiter(array('*'))) {
return null; return;
} }
throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next); throw SyntaxErrorException::unexpectedToken('identifier or "*"', $next);

View File

@ -132,7 +132,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
} }
if (!$this->container->hasDefinition($id)) { if (!$this->container->hasDefinition($id)) {
return null; return;
} }
return $id; return $id;

View File

@ -159,7 +159,7 @@ class CheckReferenceValidityPass implements CompilerPassInterface
private function getDefinition($id) private function getDefinition($id)
{ {
if (!$this->container->hasDefinition($id)) { if (!$this->container->hasDefinition($id)) {
return null; return;
} }
return $this->container->getDefinition($id); return $this->container->getDefinition($id);

View File

@ -310,7 +310,7 @@ class Container implements IntrospectableContainerInterface
throw new ServiceNotFoundException($id, null, null, $alternatives); throw new ServiceNotFoundException($id, null, null, $alternatives);
} }
return null; return;
} }
$this->loading[$id] = true; $this->loading[$id] = true;
@ -325,7 +325,7 @@ class Container implements IntrospectableContainerInterface
} }
if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
return null; return;
} }
throw $e; throw $e;

View File

@ -478,7 +478,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
$definition = $this->getDefinition($id); $definition = $this->getDefinition($id);
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
return null; return;
} }
throw $e; throw $e;
@ -492,7 +492,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
unset($this->loading[$id]); unset($this->loading[$id]);
if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
return null; return;
} }
throw $e; throw $e;

View File

@ -96,8 +96,6 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
return $configuration; return $configuration;
} }
} }
return null;
} }
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)

View File

@ -36,6 +36,5 @@ class ProjectExtension implements ExtensionInterface
public function getConfiguration(array $config, ContainerBuilder $container) public function getConfiguration(array $config, ContainerBuilder $container)
{ {
return null;
} }
} }

View File

@ -97,7 +97,7 @@ class Crawler extends \SplObjectStorage
// DOM only for HTML/XML content // DOM only for HTML/XML content
if (!preg_match('/(x|ht)ml/i', $type, $xmlMatches)) { if (!preg_match('/(x|ht)ml/i', $type, $xmlMatches)) {
return null; return;
} }
$charset = null; $charset = null;
@ -784,8 +784,6 @@ class Crawler extends \SplObjectStorage
} }
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
} }
return null;
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }

View File

@ -136,7 +136,6 @@ abstract class AbstractExtension implements FormExtensionInterface
*/ */
protected function loadTypeGuesser() protected function loadTypeGuesser()
{ {
return null;
} }
/** /**

View File

@ -211,7 +211,6 @@ class Button implements \IteratorAggregate, FormInterface
*/ */
public function getData() public function getData()
{ {
return null;
} }
/** /**
@ -221,7 +220,6 @@ class Button implements \IteratorAggregate, FormInterface
*/ */
public function getNormData() public function getNormData()
{ {
return null;
} }
/** /**
@ -231,7 +229,6 @@ class Button implements \IteratorAggregate, FormInterface
*/ */
public function getViewData() public function getViewData()
{ {
return null;
} }
/** /**
@ -281,7 +278,6 @@ class Button implements \IteratorAggregate, FormInterface
*/ */
public function getPropertyPath() public function getPropertyPath()
{ {
return null;
} }
/** /**

View File

@ -549,7 +549,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getEventDispatcher() public function getEventDispatcher()
{ {
return null;
} }
/** /**
@ -567,7 +566,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getPropertyPath() public function getPropertyPath()
{ {
return null;
} }
/** /**
@ -647,7 +645,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getDataMapper() public function getDataMapper()
{ {
return null;
} }
/** /**
@ -687,7 +684,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getEmptyData() public function getEmptyData()
{ {
return null;
} }
/** /**
@ -732,7 +728,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getData() public function getData()
{ {
return null;
} }
/** /**
@ -742,7 +737,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getDataClass() public function getDataClass()
{ {
return null;
} }
/** /**
@ -762,7 +756,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getFormFactory() public function getFormFactory()
{ {
return null;
} }
/** /**
@ -772,7 +765,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getAction() public function getAction()
{ {
return null;
} }
/** /**
@ -782,7 +774,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getMethod() public function getMethod()
{ {
return null;
} }
/** /**
@ -792,7 +783,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
*/ */
public function getRequestHandler() public function getRequestHandler()
{ {
return null;
} }
/** /**

View File

@ -73,7 +73,7 @@ class ArrayToPartsTransformer implements DataTransformerInterface
if (count($emptyKeys) > 0) { if (count($emptyKeys) > 0) {
if (count($emptyKeys) === count($this->partMapping)) { if (count($emptyKeys) === count($this->partMapping)) {
// All parts empty // All parts empty
return null; return;
} }
throw new TransformationFailedException( throw new TransformationFailedException(

View File

@ -50,7 +50,7 @@ class BooleanToStringTransformer implements DataTransformerInterface
public function transform($value) public function transform($value)
{ {
if (null === $value) { if (null === $value) {
return null; return;
} }
if (!is_bool($value)) { if (!is_bool($value)) {

View File

@ -106,13 +106,11 @@ class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
if (isset($choices[$i])) { if (isset($choices[$i])) {
return $choices[$i] === '' ? null : $choices[$i]; return $choices[$i] === '' ? null : $choices[$i];
} elseif ($this->placeholderPresent && 'placeholder' === $i) { } elseif ($this->placeholderPresent && 'placeholder' === $i) {
return null; return;
} else { } else {
throw new TransformationFailedException(sprintf('The choice "%s" does not exist', $i)); throw new TransformationFailedException(sprintf('The choice "%s" does not exist', $i));
} }
} }
} }
return null;
} }
} }

View File

@ -46,7 +46,7 @@ class ChoiceToValueTransformer implements DataTransformerInterface
// These are now valid ChoiceList values, so we can return null // These are now valid ChoiceList values, so we can return null
// right away // right away
if ('' === $value || null === $value) { if ('' === $value || null === $value) {
return null; return;
} }
$choices = $this->choiceList->getChoicesForValues(array($value)); $choices = $this->choiceList->getChoicesForValues(array($value));

View File

@ -119,7 +119,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
public function reverseTransform($value) public function reverseTransform($value)
{ {
if (null === $value) { if (null === $value) {
return null; return;
} }
if (!is_array($value)) { if (!is_array($value)) {
@ -127,7 +127,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
} }
if ('' === implode('', $value)) { if ('' === implode('', $value)) {
return null; return;
} }
$emptyFields = array(); $emptyFields = array();

View File

@ -121,7 +121,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
} }
if ('' === $value) { if ('' === $value) {
return null; return;
} }
$timestamp = $this->getIntlDateFormatter()->parse($value); $timestamp = $this->getIntlDateFormatter()->parse($value);

View File

@ -49,7 +49,7 @@ class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
} }
if ('' === $rfc3339) { if ('' === $rfc3339) {
return null; return;
} }
try { try {

View File

@ -131,7 +131,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
public function reverseTransform($value) public function reverseTransform($value)
{ {
if (empty($value)) { if (empty($value)) {
return null; return;
} }
if (!is_string($value)) { if (!is_string($value)) {

View File

@ -35,7 +35,7 @@ class DateTimeToTimestampTransformer extends BaseDateTimeTransformer
public function transform($value) public function transform($value)
{ {
if (null === $value) { if (null === $value) {
return null; return;
} }
if (!$value instanceof \DateTime) { if (!$value instanceof \DateTime) {
@ -65,7 +65,7 @@ class DateTimeToTimestampTransformer extends BaseDateTimeTransformer
public function reverseTransform($value) public function reverseTransform($value)
{ {
if (null === $value) { if (null === $value) {
return null; return;
} }
if (!is_numeric($value)) { if (!is_numeric($value)) {

View File

@ -31,7 +31,7 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
} }
if ('' === $value) { if ('' === $value) {
return null; return;
} }
if ('NaN' === $value) { if ('NaN' === $value) {

View File

@ -102,7 +102,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
} }
if ('' === $value) { if ('' === $value) {
return null; return;
} }
if ('NaN' === $value) { if ('NaN' === $value) {

View File

@ -115,7 +115,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
} }
if ('' === $value) { if ('' === $value) {
return null; return;
} }
$formatter = $this->getNumberFormatter(); $formatter = $this->getNumberFormatter();

View File

@ -78,7 +78,7 @@ class ValueToDuplicatesTransformer implements DataTransformerInterface
if (count($emptyKeys) > 0) { if (count($emptyKeys) > 0) {
if (count($emptyKeys) == count($this->keys)) { if (count($emptyKeys) == count($this->keys)) {
// All keys empty // All keys empty
return null; return;
} }
throw new TransformationFailedException( throw new TransformationFailedException(

View File

@ -26,7 +26,6 @@ class ButtonType extends BaseType implements ButtonTypeInterface
*/ */
public function getParent() public function getParent()
{ {
return null;
} }
/** /**

View File

@ -190,10 +190,10 @@ class ChoiceType extends AbstractType
$emptyValueNormalizer = function (Options $options, $emptyValue) { $emptyValueNormalizer = function (Options $options, $emptyValue) {
if ($options['multiple']) { if ($options['multiple']) {
// never use an empty value for this case // never use an empty value for this case
return null; return;
} elseif (false === $emptyValue) { } elseif (false === $emptyValue) {
// an empty value should be added but the user decided otherwise // an empty value should be added but the user decided otherwise
return null; return;
} elseif ($options['expanded'] && '' === $emptyValue) { } elseif ($options['expanded'] && '' === $emptyValue) {
// never use an empty label for radio buttons // never use an empty label for radio buttons
return 'None'; return 'None';

View File

@ -201,7 +201,6 @@ class FormType extends BaseType
*/ */
public function getParent() public function getParent()
{ {
return null;
} }
/** /**

View File

@ -35,7 +35,7 @@ abstract class BaseValidatorExtension extends AbstractTypeExtension
} }
if (empty($groups)) { if (empty($groups)) {
return null; return;
} }
if (is_callable($groups)) { if (is_callable($groups)) {

View File

@ -26,7 +26,7 @@ class ServerParams
$iniMax = strtolower($this->getNormalizedIniPostMaxSize()); $iniMax = strtolower($this->getNormalizedIniPostMaxSize());
if ('' === $iniMax) { if ('' === $iniMax) {
return null; return;
} }
$max = ltrim($iniMax, '+'); $max = ltrim($iniMax, '+');

View File

@ -159,8 +159,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
case 'Symfony\Component\Validator\Constraints\False': case 'Symfony\Component\Validator\Constraints\False':
return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE); return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE);
} }
return null;
} }
/** /**
@ -178,8 +176,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
case 'Symfony\Component\Validator\Constraints\True': case 'Symfony\Component\Validator\Constraints\True':
return new ValueGuess(true, Guess::HIGH_CONFIDENCE); return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
} }
return null;
} }
/** /**
@ -210,8 +206,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
} }
break; break;
} }
return null;
} }
/** /**
@ -250,8 +244,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
} }
break; break;
} }
return null;
} }
/** /**

View File

@ -64,8 +64,6 @@ class MappingRule
if ($propertyPath === (string) $this->propertyPath) { if ($propertyPath === (string) $this->propertyPath) {
return $this->getTarget(); return $this->getTarget();
} }
return null;
} }
/** /**

View File

@ -172,7 +172,7 @@ class ViolationMapper implements ViolationMapperInterface
// Make the path longer until we find a matching child // Make the path longer until we find a matching child
while (true) { while (true) {
if (!$it->valid()) { if (!$it->valid()) {
return null; return;
} }
if ($it->isIndex()) { if ($it->isIndex()) {
@ -223,8 +223,6 @@ class ViolationMapper implements ViolationMapperInterface
return $foundChild; return $foundChild;
} }
} }
return null;
} }
/** /**

View File

@ -127,7 +127,7 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface
public function getParent() public function getParent()
{ {
if ($this->length <= 1) { if ($this->length <= 1) {
return null; return;
} }
$parent = clone $this; $parent = clone $this;

View File

@ -209,7 +209,7 @@ class Form implements \IteratorAggregate, FormInterface
} }
if (null === $this->getName() || '' === $this->getName()) { if (null === $this->getName() || '' === $this->getName()) {
return null; return;
} }
$parent = $this->parent; $parent = $this->parent;
@ -767,8 +767,6 @@ class Form implements \IteratorAggregate, FormInterface
if ($this->parent && method_exists($this->parent, 'getClickedButton')) { if ($this->parent && method_exists($this->parent, 'getClickedButton')) {
return $this->parent->getClickedButton(); return $this->parent->getClickedButton();
} }
return null;
} }
/** /**

View File

@ -180,7 +180,7 @@ class NativeRequestHandler implements RequestHandlerInterface
if (self::$fileKeys === $keys) { if (self::$fileKeys === $keys) {
if (UPLOAD_ERR_NO_FILE === $data['error']) { if (UPLOAD_ERR_NO_FILE === $data['error']) {
return null; return;
} }
return $data; return $data;

View File

@ -64,7 +64,7 @@ abstract class BaseValidatorExtensionTest extends TypeTestCase
public function testValidationGroupsCanBeSetToClosure() public function testValidationGroupsCanBeSetToClosure()
{ {
$form = $this->createForm(array( $form = $this->createForm(array(
'validation_groups' => function (FormInterface $form) { return null; }, 'validation_groups' => function (FormInterface $form) { return; },
)); ));
$this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups'))); $this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups')));

View File

@ -27,6 +27,5 @@ class FooType extends AbstractType
public function getParent() public function getParent()
{ {
return null;
} }
} }

View File

@ -62,7 +62,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
} }
if (!self::isSupported()) { if (!self::isSupported()) {
return null; return;
} }
ob_start(); ob_start();
@ -72,14 +72,14 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
if ($return > 0) { if ($return > 0) {
ob_end_clean(); ob_end_clean();
return null; return;
} }
$type = trim(ob_get_clean()); $type = trim(ob_get_clean());
if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) {
// it's not a type, but an error message // it's not a type, but an error message
return null; return;
} }
return $match[1]; return $match[1];

View File

@ -59,11 +59,11 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
} }
if (!self::isSupported()) { if (!self::isSupported()) {
return null; return;
} }
if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) { if (!$finfo = new \finfo(FILEINFO_MIME_TYPE, $this->magicFile)) {
return null; return;
} }
return $finfo->file($path); return $finfo->file($path);

View File

@ -1264,8 +1264,6 @@ class Request
return $format; return $format;
} }
} }
return null;
} }
/** /**

View File

@ -714,8 +714,6 @@ class Response
if (null !== $this->getExpires()) { if (null !== $this->getExpires()) {
return $this->getExpires()->format('U') - $this->getDate()->format('U'); return $this->getExpires()->format('U') - $this->getDate()->format('U');
} }
return null;
} }
/** /**
@ -772,8 +770,6 @@ class Response
if (null !== $maxAge = $this->getMaxAge()) { if (null !== $maxAge = $this->getMaxAge()) {
return $maxAge - $this->getAge(); return $maxAge - $this->getAge();
} }
return null;
} }
/** /**

View File

@ -239,7 +239,5 @@ class PdoSessionHandler implements \SessionHandlerInterface
case 'sqlite': case 'sqlite':
return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)"; return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)";
} }
return null;
} }
} }

View File

@ -141,7 +141,6 @@ abstract class Bundle extends ContainerAware implements BundleInterface
*/ */
public function getParent() public function getParent()
{ {
return null;
} }
/** /**

View File

@ -121,7 +121,7 @@ class Store implements StoreInterface
$key = $this->getCacheKey($request); $key = $this->getCacheKey($request);
if (!$entries = $this->getMetadata($key)) { if (!$entries = $this->getMetadata($key)) {
return null; return;
} }
// find a cached entry that matches the request. // find a cached entry that matches the request.
@ -135,7 +135,7 @@ class Store implements StoreInterface
} }
if (null === $match) { if (null === $match) {
return null; return;
} }
list($req, $headers) = $match; list($req, $headers) = $match;
@ -146,7 +146,6 @@ class Store implements StoreInterface
// TODO the metaStore referenced an entity that doesn't exist in // TODO the metaStore referenced an entity that doesn't exist in
// the entityStore. We definitely want to return nil but we should // the entityStore. We definitely want to return nil but we should
// also purge the entry from the meta-store when this is detected. // also purge the entry from the meta-store when this is detected.
return null;
} }
/** /**

View File

@ -116,7 +116,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
public function read($token) public function read($token)
{ {
if (!$token || !file_exists($file = $this->getFilename($token))) { if (!$token || !file_exists($file = $this->getFilename($token))) {
return null; return;
} }
return $this->createProfileFromData($token, unserialize(file_get_contents($file))); return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
@ -215,7 +215,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
$position = ftell($file); $position = ftell($file);
if (0 === $position) { if (0 === $position) {
return null; return;
} }
while (true) { while (true) {

View File

@ -77,8 +77,6 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface
if (isset($data[0]['data'])) { if (isset($data[0]['data'])) {
return $this->createProfileFromData($token, $data[0]); return $this->createProfileFromData($token, $data[0]);
} }
return null;
} }
/** /**

View File

@ -273,13 +273,13 @@ class Profiler
private function getTimestamp($value) private function getTimestamp($value)
{ {
if (null === $value || '' == $value) { if (null === $value || '' == $value) {
return null; return;
} }
try { try {
$value = new \DateTime(is_numeric($value) ? '@'.$value : $value); $value = new \DateTime(is_numeric($value) ? '@'.$value : $value);
} catch (\Exception $e) { } catch (\Exception $e) {
return null; return;
} }
return $value->getTimestamp(); return $value->getTimestamp();

View File

@ -379,8 +379,6 @@ class IntlDateFormatter
if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
return date_default_timezone_get(); return date_default_timezone_get();
} }
return null;
} }
/** /**

View File

@ -28,7 +28,7 @@ class LanguageBundle extends AbstractBundle implements LanguageBundleInterface
} }
if (null === ($languages = $this->readEntry($locale, array('Languages'), true))) { if (null === ($languages = $this->readEntry($locale, array('Languages'), true))) {
return null; return;
} }
// Some languages are translated together with their region, // Some languages are translated together with their region,
@ -87,7 +87,7 @@ class LanguageBundle extends AbstractBundle implements LanguageBundleInterface
// "af" (Afrikaans) has no "Scripts" block // "af" (Afrikaans) has no "Scripts" block
if (!isset($data['Scripts'][$script])) { if (!isset($data['Scripts'][$script])) {
return null; return;
} }
return $data['Scripts'][$script]; return $data['Scripts'][$script];

View File

@ -105,7 +105,7 @@ class StructuredBundleReader implements StructuredBundleReaderInterface
private function getFallbackLocale($locale) private function getFallbackLocale($locale)
{ {
if (false === $pos = strrpos($locale, '_')) { if (false === $pos = strrpos($locale, '_')) {
return null; return;
} }
return substr($locale, 0, $pos); return substr($locale, 0, $pos);

View File

@ -195,7 +195,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
// Currently the only available variant is POSIX, which we don't want // Currently the only available variant is POSIX, which we don't want
// to include in the list // to include in the list
if (count($variants) > 0) { if (count($variants) > 0) {
return null; return;
} }
// Some languages are translated together with their region, // Some languages are translated together with their region,
@ -207,7 +207,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
// Some languages are simply not translated // Some languages are simply not translated
// Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans) // Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
if (null === ($name = $this->languageBundle->getLanguageName($lang, null, $displayLocale))) { if (null === ($name = $this->languageBundle->getLanguageName($lang, null, $displayLocale))) {
return null; return;
} }
// "as" (Assamese) has no "Variants" block // "as" (Assamese) has no "Variants" block
@ -222,7 +222,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
if ($script) { if ($script) {
// Some scripts are not translated into every language // Some scripts are not translated into every language
if (null === ($scriptName = $this->languageBundle->getScriptName($script, $lang, $displayLocale))) { if (null === ($scriptName = $this->languageBundle->getScriptName($script, $lang, $displayLocale))) {
return null; return;
} }
$extras[] = $scriptName; $extras[] = $scriptName;
@ -233,7 +233,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
if ($region) { if ($region) {
// Some regions are not translated into every language // Some regions are not translated into every language
if (null === ($regionName = $this->regionBundle->getCountryName($region, $displayLocale))) { if (null === ($regionName = $this->regionBundle->getCountryName($region, $displayLocale))) {
return null; return;
} }
$extras[] = $regionName; $extras[] = $regionName;

View File

@ -20,7 +20,7 @@ class RecursiveArrayAccess
{ {
foreach ($indices as $index) { foreach ($indices as $index) {
if (!$array instanceof \ArrayAccess && !is_array($array)) { if (!$array instanceof \ArrayAccess && !is_array($array)) {
return null; return;
} }
$array = $array[$index]; $array = $array[$index];

View File

@ -62,7 +62,7 @@ function get_icu_version_from_genrb($genrb)
} }
if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) { if (!preg_match('/ICU version ([\d\.]+)/', implode('', $output), $matches)) {
return null; return;
} }
return $matches[1]; return $matches[1];

View File

@ -83,7 +83,7 @@ class Version
} }
if (!preg_match('/^' . $pattern . '/', $version, $matches)) { if (!preg_match('/^' . $pattern . '/', $version, $matches)) {
return null; return;
} }
return $matches[0]; return $matches[0];

View File

@ -183,7 +183,7 @@ class Locale extends \Locale
protected static function getFallbackLocale($locale) protected static function getFallbackLocale($locale)
{ {
if (false === $pos = strrpos($locale, '_')) { if (false === $pos = strrpos($locale, '_')) {
return null; return;
} }
return substr($locale, 0, $pos); return substr($locale, 0, $pos);

View File

@ -415,8 +415,6 @@ class PropertyAccessor implements PropertyAccessorInterface
)); ));
} }
} }
return null;
} }
/** /**

View File

@ -155,7 +155,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
public function getParent() public function getParent()
{ {
if ($this->length <= 1) { if ($this->length <= 1) {
return null; return;
} }
$parent = clone $this; $parent = clone $this;

View File

@ -171,7 +171,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
$this->logger->error($message); $this->logger->error($message);
} }
return null; return;
} }
$url = $token[1].$mergedParams[$token[3]].$url; $url = $token[1].$mergedParams[$token[3]].$url;
@ -224,7 +224,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
$this->logger->error($message); $this->logger->error($message);
} }
return null; return;
} }
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost; $routeHost = $token[1].$mergedParams[$token[3]].$routeHost;

View File

@ -96,14 +96,14 @@ class DoctrineAclCache implements AclCacheInterface
{ {
$lookupKey = $this->getAliasKeyForIdentity($aclId); $lookupKey = $this->getAliasKeyForIdentity($aclId);
if (!$this->cache->contains($lookupKey)) { if (!$this->cache->contains($lookupKey)) {
return null; return;
} }
$key = $this->cache->fetch($lookupKey); $key = $this->cache->fetch($lookupKey);
if (!$this->cache->contains($key)) { if (!$this->cache->contains($key)) {
$this->cache->delete($lookupKey); $this->cache->delete($lookupKey);
return null; return;
} }
return $this->unserializeAcl($this->cache->fetch($key)); return $this->unserializeAcl($this->cache->fetch($key));
@ -116,7 +116,7 @@ class DoctrineAclCache implements AclCacheInterface
{ {
$key = $this->getDataKeyByIdentity($oid); $key = $this->getDataKeyByIdentity($oid);
if (!$this->cache->contains($key)) { if (!$this->cache->contains($key)) {
return null; return;
} }
return $this->unserializeAcl($this->cache->fetch($key)); return $this->unserializeAcl($this->cache->fetch($key));
@ -154,7 +154,7 @@ class DoctrineAclCache implements AclCacheInterface
$parentAcl = $this->getFromCacheById($parentId); $parentAcl = $this->getFromCacheById($parentId);
if (null === $parentAcl) { if (null === $parentAcl) {
return null; return;
} }
$acl->setParentAcl($parentAcl); $acl->setParentAcl($parentAcl);

View File

@ -29,7 +29,7 @@ class ObjectIdentityRetrievalStrategy implements ObjectIdentityRetrievalStrategy
try { try {
return ObjectIdentity::fromDomainObject($domainObject); return ObjectIdentity::fromDomainObject($domainObject);
} catch (InvalidDomainObjectException $failed) { } catch (InvalidDomainObjectException $failed) {
return null; return;
} }
} }
} }

View File

@ -92,7 +92,7 @@ class BasicPermissionMap implements PermissionMapInterface
public function getMasks($permission, $object) public function getMasks($permission, $object)
{ {
if (!isset($this->map[$permission])) { if (!isset($this->map[$permission])) {
return null; return;
} }
return $this->map[$permission]; return $this->map[$permission];

View File

@ -40,7 +40,7 @@ class AnonymousAuthenticationProvider implements AuthenticationProviderInterface
public function authenticate(TokenInterface $token) public function authenticate(TokenInterface $token)
{ {
if (!$this->supports($token)) { if (!$this->supports($token)) {
return null; return;
} }
if ($this->key !== $token->getKey()) { if ($this->key !== $token->getKey()) {

View File

@ -53,7 +53,7 @@ class PreAuthenticatedAuthenticationProvider implements AuthenticationProviderIn
public function authenticate(TokenInterface $token) public function authenticate(TokenInterface $token)
{ {
if (!$this->supports($token)) { if (!$this->supports($token)) {
return null; return;
} }
if (!$user = $token->getUser()) { if (!$user = $token->getUser()) {

View File

@ -58,7 +58,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
public function authenticate(TokenInterface $token) public function authenticate(TokenInterface $token)
{ {
if (!$this->supports($token)) { if (!$this->supports($token)) {
return null; return;
} }
$username = $token->getUsername(); $username = $token->getUsername();

View File

@ -64,7 +64,6 @@ final class User implements AdvancedUserInterface
*/ */
public function getSalt() public function getSalt()
{ {
return null;
} }
/** /**

View File

@ -171,7 +171,7 @@ class ContextListener implements ListenerInterface
$this->logger->warning(sprintf('Username "%s" could not be found.', $notFound->getUsername())); $this->logger->warning(sprintf('Username "%s" could not be found.', $notFound->getUsername()));
} }
return null; return;
} }
} }

View File

@ -142,8 +142,6 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
} }
$this->cancelCookie($request); $this->cancelCookie($request);
return null;
} }
/** /**

View File

@ -144,7 +144,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bar) { 'bar' => function ($bar) {
return null; return;
}, },
), ),
'baz', 'baz',

View File

@ -190,8 +190,6 @@ class Section
return $child; return $child;
} }
} }
return null;
} }
/** /**

View File

@ -253,8 +253,6 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf
return $this->metadata[$domain][$key]; return $this->metadata[$domain][$key];
} }
} }
return null;
} }
/** /**

View File

@ -168,7 +168,6 @@ abstract class Constraint
*/ */
public function getDefaultOption() public function getDefaultOption()
{ {
return null;
} }
/** /**

View File

@ -78,7 +78,7 @@ class Regex extends Constraint
{ {
// If match = false, pattern should not be added to HTML5 validation // If match = false, pattern should not be added to HTML5 validation
if (!$this->match) { if (!$this->match) {
return null; return;
} }
if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) { if (preg_match('/^(.)(\^?)(.*?)(\$?)\1$/', $this->pattern, $matches)) {
@ -92,7 +92,5 @@ class Regex extends Constraint
return $start.$pattern.$end; return $start.$pattern.$end;
} }
return null;
} }
} }

View File

@ -168,8 +168,6 @@ class ExecutionContext implements ExecutionContextInterface
if ($this->metadata instanceof ClassBasedInterface) { if ($this->metadata instanceof ClassBasedInterface) {
return $this->metadata->getClassName(); return $this->metadata->getClassName();
} }
return null;
} }
/** /**
@ -180,8 +178,6 @@ class ExecutionContext implements ExecutionContextInterface
if ($this->metadata instanceof PropertyMetadataInterface) { if ($this->metadata instanceof PropertyMetadataInterface) {
return $this->metadata->getPropertyName(); return $this->metadata->getPropertyName();
} }
return null;
} }
/** /**

View File

@ -33,7 +33,5 @@ class ConstraintAValidator extends ConstraintValidator
return; return;
} }
return;
} }
} }

View File

@ -19,7 +19,5 @@ class FailingConstraintValidator extends ConstraintValidator
public function validate($value, Constraint $constraint) public function validate($value, Constraint $constraint)
{ {
$this->context->addViolation($constraint->message, array()); $this->context->addViolation($constraint->message, array());
return;
} }
} }

View File

@ -393,7 +393,7 @@ class Inline
case 'null' === $scalarLower: case 'null' === $scalarLower:
case '' === $scalar: case '' === $scalar:
case '~' === $scalar: case '~' === $scalar:
return null; return;
case 'true' === $scalarLower: case 'true' === $scalarLower:
return true; return true;
case 'false' === $scalarLower: case 'false' === $scalarLower:
@ -414,7 +414,7 @@ class Inline
throw new ParseException('Object support when parsing a YAML file has been disabled.'); throw new ParseException('Object support when parsing a YAML file has been disabled.');
} }
return null; return;
case ctype_digit($scalar): case ctype_digit($scalar):
$raw = $scalar; $raw = $scalar;
$cast = intval($scalar); $cast = intval($scalar);