8000 minor #33252 Fix inconsistent return points (derrabus) · symfony/symfony@8069b58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8069b58

Browse files
minor #33252 Fix inconsistent return points (derrabus)
This PR was merged into the 3.4 branch. Discussion ---------- Fix inconsistent return points | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17201 in preparation for #33228 | License | MIT | Doc PR | N/A Inconsistent return points in methods prevent adding return types. I thought, I'll give it a try and fix them. After this PR, PhpStorm's inspection still finds 39 issues, but as far as I can tell, they're either false positives or fixture code. Commits ------- f5b6ee9 Fix inconsistent return points.
2 parents 55a484d + f5b6ee9 commit 8069b58

File tree

131 files changed

+420
-210
lines changed
  • Console/Descriptor
  • EventListener
  • Templating
  • Tests/DependencyInjection
  • SecurityBundle/Command
  • TwigBundle
  • WebProfilerBundle/Tests/Controller
  • WebServerBundle
  • Component
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    131 files changed

    +420
    -210
    lines changed

    src/Symfony/Bridge/Doctrine/ExpressionLanguage/DoctrineParserCache.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -37,7 +37,7 @@ public function __construct(Cache $cache)
    3737
    public function fetch($key)
    3838
    {
    3939
    if (false === $value = $this->cache->fetch($key)) {
    40-
    return;
    40+
    return null;
    4141
    }
    4242

    4343
    return $value;

    src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

    Lines changed: 8 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -118,6 +118,8 @@ public function guessRequired($class, $property)
    118118

    119119
    return new ValueGuess(!$mapping['joinColumns'][0]['nullable'], Guess::HIGH_CONFIDENCE);
    120120
    }
    121+
    122+
    return null;
    121123
    }
    122124

    123125
    /**
    @@ -137,6 +139,8 @@ public function guessMaxLength($class, $property)
    137139
    return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
    138140
    }
    139141
    }
    142+
    143+
    return null;
    140144
    }
    141145

    142146
    /**
    @@ -150,6 +154,8 @@ public function guessPattern($class, $property)
    150154
    return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
    151155
    }
    152156
    }
    157+
    158+
    return null;
    153159
    }
    154160

    155161
    protected function getMetadata($class)
    @@ -171,5 +177,7 @@ protected function getMetadata($class)
    171177
    // not an entity or mapped super class, using Doctrine ORM 2.2
    172178
    }
    173179
    }
    180+
    181+
    return null;
    174182
    }
    175183
    }

    src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -157,6 +157,8 @@ public function configureOptions(OptionsResolver $resolver)
    157157

    158158
    return $doctrineChoiceLoader;
    159159
    }
    160+
    161+
    return null;
    160162
    };
    161163

    162164
    $choiceName = function (Options $options) {
    @@ -171,6 +173,7 @@ public function configureOptions(OptionsResolver $resolver)
    171173
    }
    172174

    173175
    // Otherwise, an incrementing integer is used as name automatically
    176+
    return null;
    174177
    };
    175178

    176179
    // The choices are always indexed by ID (see "choices" normalizer
    @@ -187,6 +190,7 @@ public function configureOptions(OptionsResolver $resolver)
    187190
    }
    188191

    189192
    // Otherwise, an incrementing integer is used as value automatically
    193+
    return null;
    190194
    };
    191195

    192196
    $emNormalizer = function (Options $options, $em) {

    src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -248,6 +248,8 @@ private function getMergeSql()
    248248
    return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
    249249
    "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
    250250
    }
    251+
    252+
    return null;
    251253
    }
    252254

    253255
    private function getServerVersion()

    src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

    Lines changed: 8 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -42,9 +42,9 @@ public function getProperties($class, array $context = [])
    4242
    try {
    4343
    $metadata = $this->classMetadataFactory->getMetadataFor($class);
    4444
    } catch (MappingException $exception) {
    45-
    return;
    45+
    return null;
    4646
    } catch (OrmMappingException $exception) {
    47-
    return;
    47+
    return null;
    4848
    }
    4949

    5050
    $properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
    @@ -68,9 +68,9 @@ public function getTypes($class, $property, array $context = [])
    6868
    try {
    6969
    $metadata = $this->classMetadataFactory->getMetadataFor($class);
    7070
    } catch (MappingException $exception) {
    71-
    return;
    71+
    return null;
    7272
    } catch (OrmMappingException $exception) {
    73-
    return;
    73+
    return null;
    7474
    }
    7575

    7676
    if ($metadata->hasAssociation($property)) {
    @@ -162,6 +162,8 @@ public function getTypes($class, $property, array $context = [])
    162162
    return $builtinType ? [new Type($builtinType, $nullable)] : null;
    163163
    }
    164164
    }
    165+
    166+
    return null;
    165167
    }
    166168

    167169
    /**
    @@ -225,5 +227,7 @@ private function getPhpType($doctrineType)
    225227
    case DBALType::OBJECT:
    226228
    return Type::BUILTIN_TYPE_OBJECT;
    227229
    }
    230+
    231+
    return null;
    228232
    }
    229233
    }

    src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -47,7 +47,7 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
    4747
    public function convertToDatabaseValue($value, AbstractPlatform $platform)
    4848
    {
    4949
    if (null === $value) {
    50-
    return;
    50+
    return null;
    5151
    }
    5252
    if (!$value instanceof Foo) {
    5353
    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)
    6262
    public function convertToPHPValue($value, AbstractPlatform $platform)
    6363
    {
    6464
    if (null === $value) {
    65-
    return;
    65+
    return null;
    6666
    }
    6767
    if (!\is_string($value)) {
    6868
    throw ConversionException::conversionFailed($value, self::NAME);

    src/Symfony/Bridge/PhpUnit/ClockMock.php

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -25,6 +25,8 @@ public static function withClockMock($enable = null)
    2525
    }
    2626

    2727
    self::$now = is_numeric($enable) ? (float) $enable : ($enable ? microtime(true) : null);
    28+
    29+
    return null;
    2830
    }
    2931

    3032
    public static function time()
    @@ -54,6 +56,8 @@ public static function usleep($us)
    5456
    }
    5557

    5658
    self::$now += $us / 1000000;
    59+
    60+
    return null;
    5761
    }
    5862

    5963
    public static function microtime($asFloat = false)

    src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -180,6 +180,8 @@ public static function register($mode = 0)
    180180
    ++$ref;
    181181
    }
    182182
    ++$deprecations[$group.'Count'];
    183+
    184+
    return null;
    183185
    };
    184186
    $oldErrorHandler = set_error_handler($deprecationHandler);
    185187

    @@ -291,6 +293,8 @@ public static function collectDeprecations($outputFile)
    291293
    return \call_user_func(DeprecationErrorHandler::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
    292294
    }
    293295
    $deprecations[] = array(error_reporting(), $msg, $file);
    296+
    297+
    return null;
    294298
    });
    295299

    296300
    register_shutdown_function(function () use ($outputFile, &$deprecations) {

    src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php

    Lines changed: 1 addition & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -95,11 +95,7 @@ private function findSutFqcn($test)
    9595
    $sutFqcn = str_replace('\\Tests\\', '\\', $class);
    9696
    $sutFqcn = preg_replace('{Test$}', '', $sutFqcn);
    9797

    98-
    if (!class_exists($sutFqcn)) {
    99-
    return;
    100-
    }
    101-
    102-
    return $sutFqcn;
    98+
    return class_exists($sutFqcn) ? $sutFqcn : null;
    10399
    }
    104100

    105101
    public function __destruct()

    src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -357,6 +357,8 @@ public function handleError($type, $msg, $file, $line, $context = array())
    357357
    $msg = 'Unsilenced deprecation: '.$msg;
    358358
    }
    359359
    $this->gatheredDeprecations[] = $msg;
    360+
    361+
    return null;
    360362
    }
    361363

    362364
    /**

    0 commit comments

    Comments
     (0)
    0