Skip to content

Commit ba855bb

Browse files
Backport type fixes
1 parent 7b1145e commit ba855bb

12 files changed

+16
-37
lines changed

Compiler/AutowirePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function set(string $type, string $id)
374374
$this->ambiguousServiceTypes[$type][] = $id;
375375
}
376376

377-
private function createTypeNotFoundMessageCallback(TypedReference $reference, string $label): callable
377+
private function createTypeNotFoundMessageCallback(TypedReference $reference, string $label): \Closure
378378
{
379379
if (null === $this->typesClone->container) {
380380
$this->typesClone->container = new ContainerBuilder($this->container->getParameterBag());

Config/ContainerParametersResource.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function __construct(array $parameters)
3232
$this->parameters = $parameters;
3333
}
3434

35-
/**
36-
* {@inheritdoc}
37-
*/
3835
public function __toString()
3936
{
4037
return 'container_parameters_'.md5(serialize($this->parameters));

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 array|bool|float|int|string|null The parameter value
112+
* @return mixed
113113
*
114114
* @throws InvalidArgumentException if the parameter is not defined
115115
*/

ContainerBuilder.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,6 @@ public function hasAlias($id)
883883
}
884884

885885
/**
886-
* Gets all defined aliases.
887-
*
888886
* @return Alias[] An array of aliases
889887
*/
890888
public function getAliases()

ContainerInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public function set($id, $service);
5454
public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
5555

5656
/**
57-
* Returns true if the given service is defined.
58-
*
5957
* @param string $id The service identifier
6058
*
6159
* @return bool true if the service is defined, false otherwise
@@ -76,7 +74,7 @@ public function initialized($id);
7674
*
7775
* @param string $name The parameter name
7876
*
79-
* @return array|bool|float|int|string|null The parameter value
77+
* @return mixed The parameter value
8078
*
8179
* @throws InvalidArgumentException if the parameter is not defined
8280
*/

Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ public function getDeprecationMessage($id)
805805
/**
806806
* Sets a configurator to call after the service is fully initialized.
807807
*
808-
* @param string|array|Reference $configurator A PHP function, reference or an array containing a class/Reference and a method to call
808+
* @param string|array|Reference|null $configurator A PHP function, reference or an array containing a class/Reference and a method to call
809809
*
810810
* @return $this
811811
*/

Loader/Configurator/ServiceConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ServiceConfigurator extends AbstractServiceConfigurator
4747
private $allowParent;
4848
private $path;
4949

50-
public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, $id, array $defaultTags, string $path = null)
50+
public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, ?string $id, array $defaultTags, string $path = null)
5151
{
5252
$this->container = $container;
5353
$this->instanceof = $instanceof;

Loader/YamlFileLoader.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -850,9 +850,6 @@ private function resolveServices($value, string $file, bool $isParameter = false
850850
return $value;
851851
}
852852

853-
/**
854-
* Loads from Extensions.
855-
*/
856853
private function loadFromExtensions(array $content)
857854
{
858855
foreach ($content as $namespace => $values) {
@@ -868,9 +865,6 @@ private function loadFromExtensions(array $content)
868865
}
869866
}
870867

871-
/**
872-
* Checks the keywords used to define a service.
873-
*/
874868
private function checkDefinition(string $id, array $definition, string $file)
875869
{
876870
if ($this->isLoadingInstanceof) {

ParameterBag/ContainerBag.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public function all()
3535

3636
/**
3737
* {@inheritdoc}
38+
*
39+
* @return mixed
3840
*/
3941
public function get($name)
4042
{
@@ -43,6 +45,8 @@ public function get($name)
4345

4446
/**
4547
* {@inheritdoc}
48+
*
49+
* @return bool
4650
*/
4751
public function has($name)
4852
{

ParameterBag/ParameterBag.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,21 @@ class ParameterBag implements ParameterBagInterface
2525
protected $parameters = [];
2626
protected $resolved = false;
2727

28-
/**
29-
* @param array $parameters An array of parameters
30-
*/
3128
public function __construct(array $parameters = [])
3229
{
3330
$this->add($parameters);
3431
}
3532

3633
/**
37-
* Clears all parameters.
34+
* {@inheritdoc}
3835
*/
3936
public function clear()
4037
{
4138
$this->parameters = [];
4239
}
4340

4441
/**
45-
* Adds parameters to the service container parameters.
46-
*
47-
* @param array $parameters An array of parameters
42+
* {@inheritdoc}
4843
*/
4944
public function add(array $parameters)
5045
{
@@ -104,10 +99,7 @@ public function get($name)
10499
}
105100

106101
/**
107-
* Sets a service container parameter.
108-
*
109-
* @param string $name The parameter name
110-
* @param mixed $value The parameter value
102+
* {@inheritdoc}
111103
*/
112104
public function set($name, $value)
113105
{
@@ -123,9 +115,7 @@ public function has($name)
123115
}
124116

125117
/**
126-
* Removes a parameter.
127-
*
128-
* @param string $name The parameter name
118+
* {@inheritdoc}
129119
*/
130120
public function remove($name)
131121
{

ParameterBag/ParameterBagInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public function clear();
3131
/**
3232
* Adds parameters to the service container parameters.
3333
*
34-
* @param array $parameters An array of parameters
35-
*
3634
* @throws LogicException if the parameter can not be added
3735
*/
3836
public function add(array $parameters);

Tests/Compiler/ResolveChildDefinitionsPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function testDeepDefinitionsResolving()
250250

251251
$container->register('parent', 'parentClass');
252252
$container->register('sibling', 'siblingClass')
253-
->setConfigurator(new ChildDefinition('parent'), 'foo')
253+
->setConfigurator([new ChildDefinition('parent'), 'foo'])
254254
->setFactory([new ChildDefinition('parent'), 'foo'])
255255
->addArgument(new ChildDefinition('parent'))
256256
->setProperty('prop', new ChildDefinition('parent'))
@@ -260,8 +260,8 @@ public function testDeepDefinitionsResolving()
260260
$this->process($container);
261261

262262
$configurator = $container->getDefinition('sibling')->getConfigurator();
263-
$this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($configurator));
264-
$this->assertSame('parentClass', $configurator->getClass());
263+
$this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($configurator[0]));
264+
$this->assertSame('parentClass', $configurator[0]->getClass());
265265

266266
$factory = $container->getDefinition('sibling')->getFactory();
267267
$this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($factory[0]));

0 commit comments

Comments
 (0)