Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit284a935

Browse files
[DependencyInjection] Remove deprecations across the component
1 parentf0a5f45 commit284a935

18 files changed

+51
-591
lines changed

‎UPGRADE-7.0.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Symfony 6.4 and Symfony 7.0 will be released simultaneously at the end of Novemb
55
release process, both versions will have the same features, but Symfony 7.0 won't include any deprecated features.
66
To upgrade, make sure to resolve all deprecation notices.
77

8+
DependencyInjection
9+
-------------------
10+
11+
* Remove`#[MapDecorated]`, use`#[AutowireDecorated]` instead
12+
* Remove`ProxyHelper`, use`Symfony\Component\VarExporter\ProxyHelper` instead
13+
* Remove`ReferenceSetArgumentTrait`
14+
* Remove support of`@required` annotation, use the`Symfony\Contracts\Service\Attribute\Required` attribute instead
15+
* Passing`null` to`ContainerAwareTrait::setContainer()` must be done explicitly
16+
* Remove`PhpDumper` options`inline_factories_parameter` and`inline_class_loader_parameter`, use`inline_factories_parameter` and`inline_class_loader_parameter` instead
17+
* Parameter names of`ParameterBag` cannot be numerics
18+
819
Serializer
920
----------
1021

‎src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php‎

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎src/Symfony/Component/DependencyInjection/Attribute/MapDecorated.php‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎src/Symfony/Component/DependencyInjection/CHANGELOG.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
CHANGELOG
22
=========
33

4+
7.0
5+
---
6+
7+
* Remove`#[MapDecorated]`, use`#[AutowireDecorated]` instead
8+
* Remove`ProxyHelper`, use`Symfony\Component\VarExporter\ProxyHelper` instead
9+
* Remove`ReferenceSetArgumentTrait`
10+
* Remove support of`@required` annotation, use the`Symfony\Contracts\Service\Attribute\Required` attribute instead
11+
* Passing`null` to`ContainerAwareTrait::setContainer()` must be done explicitly
12+
* Remove`PhpDumper` options`inline_factories_parameter` and`inline_class_loader_parameter`, use`inline_factories_parameter` and`inline_class_loader_parameter` instead
13+
* Parameter names of`ParameterBag` cannot be numerics
14+
415
6.3
516
---
617

‎src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
5656
break;
5757
}
5858
if (false !==$doc =$r->getDocComment()) {
59-
if (false !==stripos($doc,'@required') &&preg_match('#(?:^/\*\*|\n\s*+\*)\s*+@required(?:\s|\*/$)#i',$doc)) {
60-
trigger_deprecation('symfony/dependency-injection','6.3','Relying on the "@required" annotation on method "%s::%s()" is deprecated, use the "Symfony\Contracts\Service\Attribute\Required" attribute instead.',$reflectionMethod->class,$reflectionMethod->name);
61-
62-
if ($this->isWither($reflectionMethod,$doc)) {
63-
$withers[] = [$reflectionMethod->name, [],true];
64-
}else {
65-
$value->addMethodCall($reflectionMethod->name, []);
66-
}
67-
break;
68-
}
6959
if (false ===stripos($doc,'@inheritdoc') || !preg_match('#(?:^/\*\*|\n\s*+\*)\s*+(?:\{@inheritdoc\}|@inheritdoc)(?:\s|\*/$)#i',$doc)) {
7060
break;
7161
}

‎src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,11 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
4040
if (!($type =$reflectionProperty->getType())instanceof \ReflectionNamedType) {
4141
continue;
4242
}
43-
$doc =false;
4443
if (!$reflectionProperty->getAttributes(Required::class)
45-
&& ((false ===$doc =$reflectionProperty->getDocComment()) ||false ===stripos($doc,'@required') || !preg_match('#(?:^/\*\*|\n\s*+\*)\s*+@required(?:\s|\*/$)#i',$doc))
4644
) {
4745
continue;
4846
}
49-
if ($doc) {
50-
trigger_deprecation('symfony/dependency-injection','6.3','Using the "@required" annotation on property "%s::$%s" is deprecated, use the "Symfony\Contracts\Service\Attribute\Required" attribute instead.',$reflectionProperty->class,$reflectionProperty->name);
51-
}
47+
5248
if (\array_key_exists($name =$reflectionProperty->getName(),$properties)) {
5349
continue;
5450
}

‎src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,15 @@
1919
trait ContainerAwareTrait
2020
{
2121
/**
22-
* @var ContainerInterface
22+
* @var ContainerInterface|null
2323
*/
2424
protected$container;
2525

2626
/**
2727
* @return void
2828
*/
29-
publicfunctionsetContainer(ContainerInterface$container =null)
29+
publicfunctionsetContainer(?ContainerInterface$container)
3030
{
31-
if (1 >\func_num_args()) {
32-
trigger_deprecation('symfony/dependency-injection','6.2','Calling "%s::%s()" without any arguments is deprecated, pass null explicitly instead.',__CLASS__,__FUNCTION__);
33-
}
34-
3531
$this->container =$container;
3632
}
3733
}

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ public function dump(array $options = []): string|array
145145
'debug' =>true,
146146
'hot_path_tag' =>'container.hot_path',
147147
'preload_tags' => ['container.preload','container.no_preload'],
148-
'inline_factories_parameter' =>'container.dumper.inline_factories',// @deprecated since Symfony 6.3
149-
'inline_class_loader_parameter' =>'container.dumper.inline_class_loader',// @deprecated since Symfony 6.3
150148
'inline_factories' =>null,
151149
'inline_class_loader' =>null,
152150
'preload_classes' => [],
@@ -163,22 +161,11 @@ public function dump(array $options = []): string|array
163161
$this->inlineFactories =false;
164162
if (isset($options['inline_factories'])) {
165163
$this->inlineFactories =$this->asFiles &&$options['inline_factories'];
166-
}elseif (!$options['inline_factories_parameter']) {
167-
trigger_deprecation('symfony/dependency-injection','6.3','Option "inline_factories_parameter" passed to "%s()" is deprecated, use option "inline_factories" instead.',__METHOD__);
168-
}elseif ($this->container->hasParameter($options['inline_factories_parameter'])) {
169-
trigger_deprecation('symfony/dependency-injection','6.3','Option "inline_factories_parameter" passed to "%s()" is deprecated, use option "inline_factories" instead.',__METHOD__);
170-
$this->inlineFactories =$this->asFiles &&$this->container->getParameter($options['inline_factories_parameter']);
171164
}
172165

173166
$this->inlineRequires =$options['debug'];
174167
if (isset($options['inline_class_loader'])) {
175168
$this->inlineRequires =$options['inline_class_loader'];
176-
}elseif (!$options['inline_class_loader_parameter']) {
177-
trigger_deprecation('symfony/dependency-injection','6.3','Option "inline_class_loader_parameter" passed to "%s()" is deprecated, use option "inline_class_loader" instead.',__METHOD__);
178-
$this->inlineRequires =false;
179-
}elseif ($this->container->hasParameter($options['inline_class_loader_parameter'])) {
180-
trigger_deprecation('symfony/dependency-injection','6.3','Option "inline_class_loader_parameter" passed to "%s()" is deprecated, use option "inline_class_loader" instead.',__METHOD__);
181-
$this->inlineRequires =$this->container->getParameter($options['inline_class_loader_parameter']);
182169
}
183170

184171
$this->serviceLocatorTag =$options['service_locator_tag'];

‎src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php‎

Lines changed: 0 additions & 95 deletions
This file was deleted.

‎src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespaceSymfony\Component\DependencyInjection\ParameterBag;
1313

14+
useSymfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1415
useSymfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException;
1516
useSymfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
1617
useSymfony\Component\DependencyInjection\Exception\RuntimeException;
@@ -106,9 +107,7 @@ public function get(string $name): array|bool|string|int|float|\UnitEnum|null
106107
publicfunctionset(string$name,array|bool|string|int|float|\UnitEnum|null$value)
107108
{
108109
if (is_numeric($name)) {
109-
trigger_deprecation('symfony/dependency-injection','6.2',sprintf('Using numeric parameter name "%s" is deprecated and will throw as of 7.0.',$name));
110-
// uncomment the following line in 7.0
111-
// throw new InvalidArgumentException(sprintf('The parameter name "%s" cannot be numeric.', $name));
110+
thrownewInvalidArgumentException(sprintf('The parameter name "%s" cannot be numeric.',$name));
112111
}
113112

114113
$this->parameters[$name] =$value;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp