Skip to content

Commit c28f536

Browse files
[DependencyInjection][Console] tighten types
1 parent dd273bb commit c28f536

File tree

5 files changed

+10
-33
lines changed

5 files changed

+10
-33
lines changed

Container.php

Lines changed: 3 additions & 3 deletions
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
112+
* @return array|bool|string|int|float|null
113113
*
114114
* @throws InvalidArgumentException if the parameter is not defined
115115
*/
@@ -133,8 +133,8 @@ public function hasParameter($name)
133133
/**
134134
* Sets a parameter.
135135
*
136-
* @param string $name The parameter name
137-
* @param mixed $value The parameter value
136+
* @param string $name The parameter name
137+
* @param array|bool|string|int|float|null $value The parameter value
138138
*/
139139
public function setParameter($name, $value)
140140
{

ContainerInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function initialized($id);
7474
*
7575
* @param string $name The parameter name
7676
*
77-
* @return mixed The parameter value
77+
* @return array|bool|string|int|float|null
7878
*
7979
* @throws InvalidArgumentException if the parameter is not defined
8080
*/
@@ -92,8 +92,8 @@ public function hasParameter($name);
9292
/**
9393
* Sets a parameter.
9494
*
95-
* @param string $name The parameter name
96-
* @param mixed $value The parameter value
95+
* @param string $name The parameter name
96+
* @param array|bool|string|int|float|null $value The parameter value
9797
*/
9898
public function setParameter($name, $value);
9999
}

ParameterBag/ContainerBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function all()
3636
/**
3737
* {@inheritdoc}
3838
*
39-
* @return mixed
39+
* @return array|bool|string|int|float|null
4040
*/
4141
public function get($name)
4242
{

ParameterBag/ParameterBagInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function all();
4747
*
4848
* @param string $name The parameter name
4949
*
50-
* @return mixed The parameter value
50+
* @return array|bool|string|int|float|null
5151
*
5252
* @throws ParameterNotFoundException if the parameter is not defined
5353
*/
@@ -63,8 +63,8 @@ public function remove($name);
6363
/**
6464
* Sets a service container parameter.
6565
*
66-
* @param string $name The parameter name
67-
* @param mixed $value The parameter value
66+
* @param string $name The parameter name
67+
* @param array|bool|string|int|float|null $value The parameter value
6868
*
6969
* @throws LogicException if the parameter can not be set
7070
*/

Tests/Dumper/PhpDumperTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1;
4848
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber;
4949
use Symfony\Component\DependencyInjection\TypedReference;
50-
use Symfony\Component\DependencyInjection\Variable;
5150
use Symfony\Component\ExpressionLanguage\Expression;
5251

5352
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
@@ -164,28 +163,6 @@ public function testDumpCustomContainerClassWithMandatoryArgumentLessConstructor
164163
$this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_mandatory_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithMandatoryArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container']));
165164
}
166165

167-
/**
168-
* @dataProvider provideInvalidParameters
169-
*/
170-
public function testExportParameters($parameters)
171-
{
172-
$this->expectException(\InvalidArgumentException::class);
173-
$container = new ContainerBuilder(new ParameterBag($parameters));
174-
$container->compile();
175-
$dumper = new PhpDumper($container);
176-
$dumper->dump();
177-
}
178-
179-
public function provideInvalidParameters()
180-
{
181-
return [
182-
[['foo' => new Definition('stdClass')]],
183-
[['foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]],
184-
[['foo' => new Reference('foo')]],
185-
[['foo' => new Variable('foo')]],
186-
];
187-
}
188-
189166
public function testAddParameters()
190167
{
191168
$container = include self::$fixturesPath.'/containers/container8.php';

0 commit comments

Comments
 (0)