10000 minor #33242 [DI] add return-types to generated containers (nicolas-g… · symfony/symfony@b681e93 · GitHub
[go: up one dir, main page]

Skip to content

Commit b681e93

Browse files
committed
minor #33242 [DI] add return-types to generated containers (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [DI] add return-types to generated containers | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - A chunk of #33236 ready for 4.4 Commits ------- 9170919 [DI] add return-types to generated containers
2 parents c098374 + 9170919 commit b681e93

Some content is hidden

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

48 files changed

+350
-610
lines changed

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

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,13 @@ private function startClass(string $class, string $baseClass, string $baseClassW
10301030
use Symfony\Component\DependencyInjection\Exception\LogicException;
10311031
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
10321032
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
1033+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
10331034
10341035
/*{$this->docStar}
10351036
* This class has been auto-generated
10361037
* by the Symfony Dependency Injection Component.
10371038
*
1038-
* @final since Symfony 3.3
1039+
* @final
10391040
*/
10401041
class $class extends $baseClass
10411042
{
@@ -1088,12 +1089,12 @@ public function __construct()
10881089
$code .= <<<EOF
10891090
}
10901091
1091-
public function compile()
1092+
public function compile(): void
10921093
{
10931094
throw new LogicException('You cannot compile a dumped container that was already compiled.');
10941095
}
10951096
1096-
public function isCompiled()
1097+
public function isCompiled(): bool
10971098
{
10981099
return true;
10991100
}
@@ -1184,7 +1185,7 @@ private function addRemovedIds(): string
11841185

11851186
return <<<EOF
11861187
1187-
public function getRemovedIds()
1188+
public function getRemovedIds(): array
11881189
{
11891190
return {$code};
11901191
}
@@ -1363,7 +1364,7 @@ public function getParameter($name)
13631364
return $this->parameters[$name];
13641365
}
13651366
1366-
public function hasParameter($name)
1367+
public function hasParameter($name): bool
13671368
{
13681369
$name = (string) $name;
13691370
if (isset($this->buildParameters[$name])) {
@@ -1373,12 +1374,12 @@ public function hasParameter($name)
13731374
return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters);
13741375
}
13751376
1376-
public function setParameter($name, $value)
1377+
public function setParameter($name, $value): void
13771378
{
13781379
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
13791380
}
13801381
1381-
public function getParameterBag()
1382+
public function getParameterBag(): ParameterBagInterface
13821383
{
13831384
if (null === $this->parameterBag) {
13841385
$parameters = $this->parameters;
@@ -1421,26 +1422,12 @@ public function getParameterBag()
14211422
private \$loadedDynamicParameters = {$loadedDynamicParameters};
14221423
private \$dynamicParameters = [];
14231424
1424-
/*{$this->docStar}
1425-
* Computes a dynamic parameter.
1426-
*
1427-
* @param string \$name The name of the dynamic parameter to load
1428-
*
1429-
* @return mixed The value of the dynamic parameter
1430-
*
1431-
* @throws InvalidArgumentException When the dynamic parameter does not exist
1432-
*/
1433-
private function getDynamicParameter(\$name)
1425+
private function getDynamicParameter(string \$name)
14341426
{
14351427
{$getDynamicParameter}
14361428
}
14371429
1438-
/*{$this->docStar}
1439-
* Gets the default parameters.
1440-
*
1441-
* @return array An array of the default parameters
1442-
*/
1443-
protected function getDefaultParameters()
1430+
protected function getDefaultParameters(): array
14441431
{
14451432
return $parameters;
14461433
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
use Symfony\Component\DependencyInjection\Exception\LogicException;
88
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
99
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1011

1112
/**
1213
* This class has been auto-generated
1314
* by the Symfony Dependency Injection Component.
1415
*
15-
* @final since Symfony 3.3
16+
* @final
1617
*/
1718
class Symfony_DI_PhpDumper_Test_Aliases_Deprecation extends Container
1819
{
@@ -31,17 +32,17 @@ public function __construct()
3132
];
3233
}
3334

34-
public function compile()
35+
public function compile(): void
3536
{
3637
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3738
}
3839

39-
public function isCompiled()
40+
public function isCompiled(): bool
4041
{
4142
return true;
4243
}
4344

44-
public function getRemovedIds()
45+
public function getRemovedIds(): array
4546
{
4647
return [
4748
'Psr\\Container\\ContainerInterface' => true,

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
use Symfony\Component\DependencyInjection\Exception\LogicException;
1010
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1111
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
12+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1213

1314
/**
1415
* This class has been auto-generated
1516
* by the Symfony Dependency Injection Component.
1617
*
17-
* @final since Symfony 3.3
18+
* @final
1819
*/
1920
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithoutArgumentsContainer
2021
{
@@ -31,17 +32,17 @@ public function __construct()
3132
$this->aliases = [];
3233
}
3334

34-
public function compile()
35+
public function compile(): void
3536
{
3637
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3738
}
3839

39-
public function isCompiled()
40+
public function isCompiled(): bool
4041
{
4142
return true;
4243
}
4344

44-
public function getRemovedIds()
45+
public function getRemovedIds(): array
4546
{
4647
return [
4748
'Psr\\Container\\ContainerInterface' => true,

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
use Symfony\Component\DependencyInjection\Exception\LogicException;
1010
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1111
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
12+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1213

1314
/**
1415
* This class has been auto-generated
1516
* by the Symfony Dependency Injection Component.
1617
*
17-
* @final since Symfony 3.3
18+
* @final
1819
*/
1920
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithMandatoryArgumentsContainer
2021
{
@@ -28,17 +29,17 @@ public function __construct()
2829
$this->aliases = [];
2930
}
3031

31-
public function compile()
32+
public function compile(): void
3233
{
3334
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3435
}
3536

36-
public function isCompiled()
37+
public function isCompiled(): bool
3738
{
3839
return true;
3940
}
4041

41-
public function getRemovedIds()
42+
public function getRemovedIds(): array
4243
{
4344
return [
4445
'Psr\\Container\\ContainerInterface' => true,

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
use Symfony\Component\DependencyInjection\Exception\LogicException;
1010
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1111
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
12+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1213

1314
/**
1415
* This class has been auto-generated
1516
* by the Symfony Dependency Injection Component.
1617
*
17-
* @final since Symfony 3.3
18+
* @final
1819
*/
1920
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\ConstructorWithOptionalArgumentsContainer
2021
{
@@ -31,17 +32,17 @@ public function __construct()
3132
$this->aliases = [];
3233
}
3334

34-
public function compile()
35+
public function compile(): void
3536
{
3637
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3738
}
3839

39-
public function isCompiled()
40+
public function isCompiled(): bool
4041
{
4142
return true;
4243
}
4344

44-
public function getRemovedIds()
45+
public function getRemovedIds(): array
4546
{
4647
return [
4748
'Psr\\Container\\ContainerInterface' => true,

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
use Symfony\Component\DependencyInjection\Exception\LogicException;
1010
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1111
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
12+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1213

1314
/**
1415
* This class has been auto-generated
1516
* by the Symfony Dependency Injection Component.
1617
*
17-
* @final since Symfony 3.3
18+
* @final
1819
*/
1920
class ProjectServiceContainer extends \Symfony\Component\DependencyInjection\Tests\Fixtures\Container\NoConstructorContainer
2021
{
@@ -28,17 +29,17 @@ public function __construct()
2829
$this->aliases = [];
2930
}
3031

31-
public function compile()
32+
public function compile(): void
3233
{
3334
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3435
}
3536

36-
public function isCompiled()
37+
public function isCompiled(): bool
3738
{
3839
return true;
3940
}
4041

41-
public function getRemovedIds()
42+
public function getRemovedIds(): array
4243
{
4344
return [
4445
'Psr\\Container\\ContainerInterface' => true,

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
use Symfony\Component\DependencyInjection\Exception\LogicException;
1010
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1111
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
12+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1213

1314
/**
1415
* This class has been auto-generated
1516
* by the Symfony Dependency Injection Component.
1617
*
17-
* @final since Symfony 3.3
18+
* @final
1819
*/
1920
class Container extends \Symfony\Component\DependencyInjection\Dump\AbstractContainer
2021
{
@@ -28,17 +29,17 @@ public function __construct()
2829
$this->aliases = [];
2930
}
3031

31-
public function compile()
32+
public function compile(): void
3233
{
3334
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3435
}
3536

36-
public function isCompiled()
37+
public function isCompiled(): bool
3738
{
3839
return true;
3940
}
4041

41-
public function getRemovedIds()
42+
public function getRemovedIds(): array
4243
{
4344
return [
4445
'Psr\\Container\\ContainerInterface' => true,

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
use Symfony\Component\DependencyInjection\Exception\LogicException;
88
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
99
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
10+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1011

1112
/**
1213
* This class has been auto-generated
1314
* by the Symfony Dependency Injection Component.
1415
*
15-
* @final since Symfony 3.3
16+
* @final
1617
*/
1718
class ProjectServiceContainer extends Container
1819
{
@@ -26,17 +27,17 @@ public function __construct()
2627
$this->aliases = [];
2728
}
2829

29-
public function compile()
30+
public function compile(): void
3031
{
3132
throw new LogicException('You cannot compile a dumped container that was already compiled.');
3233
}
3334

34-
public function isCompiled()
35+
public function isCompiled(): bool
3536
{
3637
return true;
3738
}
3839

39-
public function getRemovedIds()
40+
public function getRemovedIds(): array
4041
{
4142
return [
4243
'Psr\\Container\\ContainerInterface' => true,

0 commit comments

Comments
 (0)
0