8000 Add missing `@return` annotations to fix deprecations on PHP 8 · symfony/symfony@3ffe557 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ffe557

Browse files
Add missing @return annotations to fix deprecations on PHP 8
1 parent 18927fe commit 3ffe557

Some content is hidden

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

42 files changed

+124
-17
lines changed

.travis.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ before_install:
149149
if [[ $PHP = 8.* ]]; then
150150
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
151151
else
152-
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
152+
tfold ext.mongodb tpecl mongodb-1.8.1 mongodb.so $INI
153153
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
154154
tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
155155
fi
@@ -215,13 +215,6 @@ install:
215215
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
216216
fi
217217
218-
- |
219-
# Set composer's platform to php 7.4 if we're on php 8.
220-
if [[ $PHP = 8.* ]]; then
221-
composer config platform.php 7.4.99
222-
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
223-
fi
224-
225218
- |
226219
# Install symfony/flex
227220
if [[ $deps = low ]]; then
@@ -262,7 +255,7 @@ install:
262255
fi
263256
phpenv global $PHP
264257
rm vendor/composer/package-versions-deprecated -Rf
265-
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.6.99; composer require --dev --no-update mongodb/mongodb ~1.5.0)
258+
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.8.99; composer require --dev --no-update mongodb/mongodb ^1.8.1)
266259
tfold 'composer update' $COMPOSER_UP
267260
tfold 'phpunit install' ./phpunit install
268261
if [[ $deps = high ]]; then
@@ -279,7 +272,7 @@ install:
279272
git fetch --depth=2 origin $SYMFONY_VERSION
280273
git checkout -m FETCH_HEAD
281274
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
282-
(cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.99; composer require --dev --no-update mongodb/mongodb)
275+
(cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.8.99; composer require --dev --no-update mongodb/mongodb)
283276
[[ ! $COMPONENTS ]] || tfold 'phpunit install' SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 ./phpunit install
284277
[[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1
285278
fi

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class StringWrapperType extends StringType
1818
{
1919
/**
2020
* {@inheritdoc}
21+
*
22+
* @return mixed
2123
*/
2224
public function convertToDatabaseValue($value, AbstractPlatform $platform)
2325
{
@@ -26,6 +28,8 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
2628

2729
/**
2830
* {@inheritdoc}
31+
*
32+
* @return mixed
2933
*/
3034
public function convertToPHPValue($value, AbstractPlatform $platform)
3135
{

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
4343

4444
/**
4545
* {@inheritdoc}
46+
*
47+
* @return mixed
4648
*/
4749
public function convertToDatabaseValue($value, AbstractPlatform $platform)
4850
{
@@ -58,6 +60,8 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
5860

5961
/**
6062
* {@inheritdoc}
63+
*
64+
* @return mixed
6165
*/
6266
public function convertToPHPValue($value, AbstractPlatform $platform)
6367
{

src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public function __construct(array $options = [])
8383

8484
/**
8585
* {@inheritdoc}
86+
*
87+
* @return mixed
8688
*/
8789
public function formatBatch(array $records)
8890
{
@@ -95,6 +97,8 @@ public function formatBatch(array $records)
9597

9698
/**
9799
* {@inheritdoc}
100+
*
101+
* @return mixed
98102
*/
99103
public function format(array $record)
100104
{

src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public function __construct(VarCloner $cloner = null)
2626
$this->cloner = $cloner ?: new VarCloner();
2727
}
2828

29+
/**
30+
* {@inheritdoc}
31+
*
32+
* @return mixed
33+
*/
2934
public function format(array $record)
3035
{
3136
$record['context'] = $this->cloner->cloneVar($record['context']);
@@ -34,6 +39,11 @@ public function format(array $record)
3439
return $record;
3540
}
3641

42+
/**
43+
* {@inheritdoc}
44+
*
45+
* @return mixed
46+
*/
3747
public function formatBatch(array $records)
3848
{
3949
foreach ($records as $k => $record) {

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function setContainer(ContainerInterface $container): ?ContainerInterface
5858
/**
5959
* Gets a container parameter by its name.
6060
*
61-
* @return mixed
61+
* @return array|bool|float|int|string|null
6262
*
6363
* @final
6464
*/

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class Controller implements ContainerAwareInterface
3131
/**
3232
* Gets a container configuration parameter by its name.
3333
*
34-
* @return mixed
34+
* @return array|bool|float|int|string|null
3535
*
3636
* @final
3737
*/

src/Symfony/Bundle/FrameworkBundle/Routing/LegacyRouteLoaderContainer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function __construct(ContainerInterface $container, ContainerInterface $s
2929

3030
/**
3131
* {@inheritdoc}
32+
*
33+
* @return mixed
3234
*/
3335
public function get($id)
3436
{

src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function getParameterBag(): ParameterBagInterface
5858

5959
/**
6060
* {@inheritdoc}
61+
*
62+
* @return array|bool|float|int|string|null
6163
*/
6264
public function getParameter($name)
6365
{

src/Symfony/Component/Cache/CacheItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function getKey(): string
4343

4444
/**
4545
* {@inheritdoc}
46+
*
47+
* @return mixed
4648
*/
4749
public function get()
4850
{

src/Symfony/Component/Cache/Psr16Cache.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
6666

6767
/**
6868
* {@inheritdoc}
69+
*
70+
* @return mixed
6971
*/
7072
public function get($key, $default = null)
7173
{

src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function __construct(\Closure $factory, array $serviceMap, array $service
3434

3535
/**
3636
* {@inheritdoc}
37+
*
38+
* @return mixed
3739
*/
3840
public function get($id)
3941
{

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getParameterBag()
109109
*
110110
* @param string $name The parameter name
111111
*
112-
* @return mixed The parameter value
112+
* @return array|bool|float|int|string|null The parameter value
113113
*
114114
* @throws InvalidArgumentException if the parameter is not defined
115115
*/

src/Symfony/Component/DependencyInjection/ContainerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function initialized($id);
7676
*
7777
* @param string $name The parameter name
7878
*
79-
* @return mixed The parameter value
79+
* @return array|bool|float|int|string|null The parameter value
8080
*
8181
* @throws InvalidArgumentException if the parameter is not defined
8282
*/

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,9 @@ private function addDefaultParametersMethod(): string
14491449

14501450
$code = <<<'EOF'
14511451
1452+
/**
1453+
* @return array|bool|float|int|string|null
1454+
*/
14521455
public function getParameter($name)
14531456
{
14541457
$name = (string) $name;

src/Symfony/Component/DependencyInjection/ServiceLocator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class ServiceLocator implements ServiceProviderInterface
3333
private $externalId;
3434
private $container;
3535

36+
/**
37+
* {@inheritdoc}
38+
*
39+
* @return mixed
40+
*/
3641
public function get($id)
3742
{
3843
if (!$this->externalId) {

src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ public function __construct(ServiceLocator $locator)
537537
$this->locator = $locator;
538538
}
539539

540+
/**
541+
* @return mixed
542+
*/
540543
public function get($id)
541544
{
542545
return $this->locator->get($id);

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ protected function getTestService()
5959
return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']);
6060
}
6161

62+
/**
63+
* @return array|bool|float|int|string|null
64+
*/
6265
public function getParameter($name)
6366
{
6467
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ protected function getTestService()
5959
return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]);
6060
}
6161

62+
/**
63+
* @return array|bool|float|int|string|null
64+
*/
6265
public function getParameter($name)
6366
{
6467
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ protected function getServiceWithMethodCallAndFactoryService()
7474
return $instance;
7575
}
7676

77+
/**
78+
* @return array|bool|float|int|string|null
79+
*/
7780
public function getParameter($name)
7881
{
7982
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ protected function getTestService()
7070
return $this->services['test'] = new ${($_ = $this->getEnv('FOO')) && false ?: "_"}($this->getEnv('Bar'), 'foo'.$this->getEnv('string:FOO').'baz', $this->getEnv('int:Baz'));
7171
}
7272

73+
/**
74+
* @return array|bool|float|int|string|null
75+
*/
7376
public function getParameter($name)
7477
{
7578
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function getRemovedIds(): array
4646
];
4747
}
4848

49+
/**
50+
* @return array|bool|float|int|string|null
51+
*/
4952
public function getParameter($name)
5053
{
5154
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,9 @@ class ProjectServiceContainer extends Container
460460
return $instance;
461461
}
462462

463+
/**
464+
* @return array|bool|float|int|string|null
465+
*/
463466
public function getParameter($name)
464467
{
465468
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ protected function getFactorySimpleService()
409409
return new \SimpleFactoryClass('foo');
410410
}
411411

412+
/**
413+
* @return array|bool|float|int|string|null
414+
*/
412415
public function getParameter($name)
413416
{
414417
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ class ProjectServiceContainer extends Container
458458
return new \SimpleFactoryClass('foo');
459459
}
460460

461+
/**
462+
* @return array|bool|float|int|string|null
463+
*/
461464
public function getParameter($name)
462465
{
463466
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class ProjectServiceContainer extends Container
9494
return new \Bar\FooClass(new \Bar\FooLazyClass());
9595
}
9696

97+
/**
98+
* @return array|bool|float|int|string|null
99+
*/
97100
public function getParameter($name)
98101
{
99102
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ protected function getBarService()
6363
return $instance;
6464
}
6565

66+
/**
67+
* @return array|bool|float|int|string|null
68+
*/
6669
public function getParameter($name)
6770
{
6871
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function getRemovedIds(): array
4646
];
4747
}
4848

49+
/**
50+
* @return array|bool|float|int|string|null
51+
*/
4952
public function getParameter($name)
5053
{
5154
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function getRemovedIds(): array
4646
];
4747
}
4848

49+
/**
50+
* @return array|bool|float|int|string|null
51+
*/
4952
public function getParameter($name)
5053
{
5154
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public function getRemovedIds(): array
4646
];
4747
}
4848

49+
/**
50+
* @return array|bool|float|int|string|null
51+
*/
4952
public function getParameter($name)
5053
{
5154
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ protected function getFooService()
7272
return $this->services['foo'] = new \stdClass(($this->privates['bar_%env(BAR)%'] ?? ($this->privates['bar_%env(BAR)%'] = new \stdClass())), ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]);
7373
}
7474

75+
/**
76+
* @return array|bool|float|int|string|null
77+
*/
7578
public function getParameter($name)
7679
{
7780
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ protected function getFactorySimpleService()
409409
return new \SimpleFactoryClass('foo');
410410
}
411411

412+
/**
413+
* @return array|bool|float|int|string|null
414+
*/
412415
public function getParameter($name)
413416
{
414417
$name = (string) $name;

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ protected function getC2Service()
9292
return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3());
9393
}
9494

95+
/**
96+
* @return array|bool|float|int|string|null
97+
*/
9598
public function getParameter($name)
9699
{
97100
$name = (string) $name;

0 commit comments

Comments
 (0)
0