Skip to content

Commit 9f1c017

Browse files
bug symfony#24722 Replace more docblocks by type-hints (nicolas-grekas)
This PR was merged into the 4.0-dev branch. Discussion ---------- Replace more docblocks by type-hints | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes (but only on constructors and final methods) | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- aaf2265 Replace more docblocks by type-hints
2 parents d7547f2 + aaf2265 commit 9f1c017

File tree

532 files changed

+932
-3011
lines changed

Some content is hidden

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

532 files changed

+932
-3011
lines changed

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,8 @@ private function sanitizeQuery($connectionName, $query)
165165
* The return value is an array with the sanitized value and a boolean
166166
* indicating if the original value was kept (allowing to use the sanitized
167167
* value to explain the query).
168-
*
169-
* @param mixed $var
170-
*
171-
* @return array
172168
*/
173-
private function sanitizeParam($var)
169+
private function sanitizeParam($var): array
174170
{
175171
if (is_object($var)) {
176172
$className = get_class($var);

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ class DoctrineValidationPass implements CompilerPassInterface
2323
{
2424
private $managerType;
2525

26-
/**
27-
* @param string $managerType
28-
*/
29-
public function __construct($managerType)
26+
public function __construct(string $managerType)
3027
{
3128
$this->managerType = $managerType;
3229
}
@@ -43,12 +40,8 @@ public function process(ContainerBuilder $container)
4340
/**
4441
* Gets the validation mapping files for the format and extends them with
4542
* files matching a doctrine search pattern (Resources/config/validation.orm.xml).
46-
*
47-
* @param ContainerBuilder $container
48-
* @param string $mapping
49-
* @param string $extension
5043
*/
51-
private function updateValidatorMappingFiles(ContainerBuilder $container, $mapping, $extension)
44+
private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension)
5245
{
5346
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
5447
return;

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
3737
* manager's service ID for a connection name
3838
* @param string $tagPrefix Tag prefix for listeners and subscribers
3939
*/
40-
public function __construct($connections, $managerTemplate, $tagPrefix)
40+
public function __construct(string $connections, string $managerTemplate, string $tagPrefix)
4141
{
4242
$this->connections = $connections;
4343
$this->managerTemplate = $managerTemplate;

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
117117
* register alias
118118
* @param string[] $aliasMap Map of alias to namespace
119119
*/
120-
public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false, $configurationPattern = '', $registerAliasMethodName = '', array $aliasMap = array())
120+
public function __construct($driver, array $namespaces, array $managerParameters, string $driverPattern, $enabledParameter = false, string $configurationPattern = '', string $registerAliasMethodName = '', array $aliasMap = array())
121121
{
122122
$this->driver = $driver;
123123
$this->namespaces = $namespaces;

src/Symfony/Bridge/Doctrine/DependencyInjection/Security/UserProvider/EntityFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EntityFactory implements UserProviderFactoryInterface
2727
private $key;
2828
private $providerId;
2929

30-
public function __construct($key, $providerId)
30+
public function __construct(string $key, string $providerId)
3131
{
3232
$this->key = $key;
3333
$this->providerId = $providerId;

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Doctrine\Common\Persistence\ObjectManager;
1515
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
1616
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
17-
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
1817
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
1918

2019
/**
@@ -45,9 +44,8 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
4544
* @param string $class The class name of the loaded objects
4645
* @param IdReader $idReader The reader for the object IDs
4746
* @param null|EntityLoaderInterface $objectLoader The objects loader
48-
* @param ChoiceListFactoryInterface $factory The factory for creating the loaded choice list
4947
*/
50-
public function __construct(ObjectManager $manager, $class, $idReader = null, $objectLoader = null, $factory = null)
48+
public function __construct(ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
5149
{
5250
$classMetadata = $manager->getClassMetadata($class);
5351

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,9 @@ public function getTypes($class, $property, array $context = array())
157157
/**
158158
* Determines whether an association is nullable.
159159
*
160-
* @param array $associationMapping
161-
*
162-
* @return bool
163-
*
164160
* @see https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Tools/EntityGenerator.php#L1221-L1246
165161
*/
166-
private function isAssociationNullable(array $associationMapping)
162+
private function isAssociationNullable(array $associationMapping): bool
167163
{
168164
if (isset($associationMapping['id']) && $associationMapping['id']) {
169165
return false;
@@ -185,12 +181,8 @@ private function isAssociationNullable(array $associationMapping)
185181

186182
/**
187183
* Gets the corresponding built-in PHP type.
188-
*
189-
* @param string $doctrineType
190-
*
191-
* @return string|null
192184
*/
193-
private function getPhpType($doctrineType)
185+
private function getPhpType(string $doctrineType): ?string
194186
{
195187
switch ($doctrineType) {
196188
case DBALType::SMALLINT:
@@ -217,5 +209,7 @@ private function getPhpType($doctrineType)
217209
case DBALType::OBJECT:
218210
return Type::BUILTIN_TYPE_OBJECT;
219211
}
212+
213+
return null;
220214
}
221215
}

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class EntityUserProvider implements UserProviderInterface
3333
private $class;
3434
private $property;
3535

36-
public function __construct(ManagerRegistry $registry, $classOrAlias, $property = null, $managerName = null)
36+
public function __construct(ManagerRegistry $registry, string $classOrAlias, string $property = null, string $managerName = null)
3737
{
3838
$this->registry = $registry;
3939
$this->managerName = $managerName;

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,9 @@ public function providerBasicDrivers()
187187
}
188188

189189
/**
190-
* @param string $class
191-
* @param array $config
192-
*
193190
* @dataProvider providerBasicDrivers
194191
*/
195-
public function testLoadBasicCacheDriver($class, array $config, array $expectedCalls = array())
192+
public function testLoadBasicCacheDriver(string $class, array $config, array $expectedCalls = array())
196193
{
197194
$container = $this->createContainer();
198195
$cacheName = 'metadata_cache';

src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapper.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ class StringWrapper
1515
{
1616
private $string;
1717

18-
/**
19-
* @param string $string
20-
*/
21-
public function __construct($string = null)
18+
public function __construct(string $string = null)
2219
{
2320
$this->string = $string;
2421
}

0 commit comments

Comments
 (0)