Skip to content

Commit 39c1a84

Browse files
Merge branch '4.4' into 5.2
* 4.4: Backport type fixes uzb translation [DependencyInjection] Fix doc blocks [DependencyInjection] Turn $defaultDeprecationTemplate into a constant [Form] better form doc types to support static analysis
2 parents 4177992 + ba855bb commit 39c1a84

15 files changed

+32
-53
lines changed

Alias.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
class Alias
1717
{
18+
private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.';
19+
1820
private $id;
1921
private $public;
2022
private $deprecation = [];
2123

22-
private static $defaultDeprecationTemplate = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.';
23-
2424
public function __construct(string $id, bool $public = false)
2525
{
2626
$this->id = $id;
@@ -117,7 +117,7 @@ public function setDeprecated(/* string $package, string $version, string $messa
117117
}
118118
}
119119

120-
$this->deprecation = $status ? ['package' => $package, 'version' => $version, 'message' => $message ?: self::$defaultDeprecationTemplate] : [];
120+
$this->deprecation = $status ? ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE] : [];
121121

122122
return $this;
123123
}

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(): string
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
@@ -853,8 +853,6 @@ public function hasAlias(string $id)
853853
}
854854

855855
/**
856-
* Gets all defined aliases.
857-
*
858856
* @return Alias[] An array of aliases
859857
*/
860858
public function getAliases()

ContainerInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public function set(string $id, ?object $service);
5151
public function get($id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
5252

5353
/**
54-
* Returns true if the given service is defined.
55-
*
5654
* @param string $id The service identifier
5755
*
5856
* @return bool true if the service is defined, false otherwise
@@ -71,7 +69,7 @@ public function initialized(string $id);
7169
*
7270
* @param string $name The parameter name
7371
*
74-
* @return array|bool|float|int|string|null The parameter value
72+
* @return mixed The parameter value
7573
*
7674
* @throws InvalidArgumentException if the parameter is not defined
7775
*/

Definition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
*/
2323
class Definition
2424
{
25+
private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.';
26+
2527
private $class;
2628
private $file;
2729
private $factory;
@@ -45,8 +47,6 @@ class Definition
4547

4648
protected $arguments = [];
4749

48-
private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.';
49-
5050
/**
5151
* @internal
5252
*
@@ -743,7 +743,7 @@ public function setDeprecated(/* string $package, string $version, string $messa
743743
}
744744

745745
$this->changes['deprecated'] = true;
746-
$this->deprecation = $status ? ['package' => $package, 'version' => $version, 'message' => $message ?: self::$defaultDeprecationTemplate] : [];
746+
$this->deprecation = $status ? ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE] : [];
747747

748748
return $this;
749749
}
@@ -790,7 +790,7 @@ public function getDeprecation(string $id): array
790790
/**
791791
* Sets a configurator to call after the service is fully initialized.
792792
*
793-
* @param string|array|Reference $configurator A PHP function, reference or an array containing a class/Reference and a method to call
793+
* @param string|array|Reference|null $configurator A PHP function, reference or an array containing a class/Reference and a method to call
794794
*
795795
* @return $this
796796
*/

Exception/ParameterNotFoundException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not
2727
private $nonNestedAlternative;
2828

2929
/**
30-
* @param string $key The requested parameter key
31-
* @param string $sourceId The service id that references the non-existent parameter
32-
* @param string $sourceKey The parameter key that references the non-existent parameter
33-
* @param \Throwable $previous The previous exception
34-
* @param string[] $alternatives Some parameter name alternatives
35-
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
30+
* @param string $key The requested parameter key
31+
* @param string|null $sourceId The service id that references the non-existent parameter
32+
* @param string|null $sourceKey The parameter key that references the non-existent parameter
33+
* @param \Throwable|null $previous The previous exception
34+
* @param string[] $alternatives Some parameter name alternatives
35+
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
3636
*/
3737
public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null)
3838
{

Loader/Configurator/ServiceConfigurator.php

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

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

Loader/YamlFileLoader.php

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

908-
/**
909-
* Loads from Extensions.
910-
*/
911908
private function loadFromExtensions(array $content)
912909
{
913910
foreach ($content as $namespace => $values) {
@@ -923,9 +920,6 @@ private function loadFromExtensions(array $content)
923920
}
924921
}
925922

926-
/**
927-
* Checks the keywords used to define a service.
928-
*/
929923
private function checkDefinition(string $id, array $definition, string $file)
930924
{
931925
if ($this->isLoadingInstanceof) {

0 commit comments

Comments
 (0)