8000 Merge branch '2.7' · symfony/symfony@56ad3e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 56ad3e6

Browse files
committed
Merge branch '2.7'
* 2.7: [2.7] Added deprecated in debug command [FrameworkBundle] remove usage of deprecated Definition::setFactoryClass(), Definition::setFactoryService() and Definition::setFactoryMethod() methods. fixed some deprecated notices [Validator] fixed some legacy tests [Validator] fixed remaining notice [DX] Attempt to improve logging messages with parameters
2 parents 2e496e1 + 245c514 commit 56ad3e6

File tree

77 files changed

+651
-209
lines changed

Some content is hidden

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

77 files changed

+651
-209
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ protected function configure()
5757
*/
5858
protected function execute(InputInterface $input, OutputInterface $output)
5959
{
60+
if (false !== strpos($input->getFirstArgument(), ':d')) {
61+
$output->writeln('<comment>The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.</comment>');
62+
}
63+
6064
$name = $input->getArgument('name');
6165

6266
if (empty($name)) {

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ protected function configure()
9494
*/
9595
protected function execute(InputInterface $input, OutputInterface $output)
9696
{
97+
if (false !== strpos($input->getFirstArgument(), ':d')) {
98+
$output->writeln('<comment>The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:container" instead.</comment>');
99+
}
100+
97101
$this->validateInput($input);
98102

99103
if ($input->getOption('parameters')) {

src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function configure()
6464
The <info>%command.name%</info> displays the configured routes:
6565
6666
<info>php %command.full_name%</info>
67-
67+
6868
EOF
6969
)
7070
;
@@ -77,6 +77,10 @@ protected function configure()
7777
*/
7878
protected function execute(InputInterface $input, OutputInterface $output)
7979
{
80+
if (false !== strpos($input->getFirstArgument(), ':d')) {
81+
$output->writeln('<comment>The use of "router:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:router" instead.</comment>');
82+
}
83+
8084
$name = $input->getArgument('name');
8185
$helper = new DescriptorHelper();
8286

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ protected function configure()
8181
*/
8282
protected function execute(InputInterface $input, OutputInterface $output)
8383
{
84+
if (false !== strpos($input->getFirstArgument(), ':d')) {
85+
$output->writeln('<comment>The use of "translation:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:translation" instead.</comment>');
86+
}
87+
8488
$locale = $input->getArgument('locale');
8589
$domain = $input->getOption('domain');
8690
$bundle = $this->getContainer()->get('kernel')->getBundle($input->getArgument('bundle'));

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,23 +212,24 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
212212
'synthetic' => $definition->isSynthetic(),
213213
'lazy' => $definition->isLazy(),
214214
);
215+
215216
if (method_exists($definition, 'isSynchronized')) {
216-
$data['synchronized'] = $definition->isSynchronized();
217+
$data['synchronized'] = $definition->isSynchronized(false);
217218
}
218219

219220
$data['abstract'] = $definition->isAbstract();
220221
$data['file'] = $definition->getFile();
221222

222-
if ($definition->getFactoryClass()) {
223-
$data['factory_class'] = $definition->getFactoryClass();
223+
if ($definition->getFactoryClass(false)) {
224+
$data['factory_class'] = $definition->getFactoryClass(false);
224225
}
225226

226-
if ($definition->getFactoryService()) {
227-
$data['factory_service'] = $definition->getFactoryService();
227+
if ($definition->getFactoryService(false)) {
228+
$data['factory_service'] = $definition->getFactoryService(false);
228229
}
229230

230-
if ($definition->getFactoryMethod()) {
231-
$data['factory_method'] = $definition->getFactoryMethod();
231+
if ($definition->getFactoryMethod(false)) {
232+
$data['factory_method'] = $definition->getFactoryMethod(false);
232233
}
233234

234235
if ($factory = $definition->getFactory()) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
186186
;
187187

188188
if (method_exists($definition, 'isSynchronized')) {
189-
$output .= "\n".'- Synchronized: '.($definition->isSynchronized() ? 'yes' : 'no');
189+
$output .= "\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no');
190190
}
191191

192192
$output .= "\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no');
@@ -195,16 +195,16 @@ protected function describeContainerDefinition(Definition $definition, array $op
195195
$output .= "\n".'- File: `'.$definition->getFile().'`';
196196
}
197197

198-
if ($definition->getFactoryClass()) {
199-
$output .= "\n".'- Factory Class: `'.$definition->getFactoryClass().'`';
198+
if ($definition->getFactoryClass(false)) {
199+
$output .= "\n".'- Factory Class: `'.$definition->getFactoryClass(false).'`';
200200
}
201201

202-
if ($definition->getFactoryService()) {
203-
$output .= "\n".'- Factory Service: `'.$definition->getFactoryService().'`';
202+
if ($definition->getFactoryService(false)) {
203+
$output .= "\n".'- Factory Service: `'.$definition->getFactoryService(false).'`';
204204
}
205205

206-
if ($definition->getFactoryMethod()) {
207-
$output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod().'`';
206+
if ($definition->getFactoryMethod(false)) {
207+
$output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod(false).'`';
208208
}
209209

210210
if ($factory = $definition->getFactory()) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,24 +264,24 @@ protected function describeContainerDefinition(Definition $definition, array $op
264264
$description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
265265
$description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
266266
if (method_exists($definition, 'isSynchronized')) {
267-
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized() ? 'yes' : 'no');
267+
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized(false) ? 'yes' : 'no');
268268
}
269269
$description[] = sprintf('<comment>Abstract</comment> %s', $definition->isAbstract() ? 'yes' : 'no');
270270

271271
if ($definition->getFile()) {
272272
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
273273
}
274274

275-
if ($definition->getFactoryClass()) {
276-
$description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass());
275+
if ($definition->getFactoryClass(false)) {
276+
$description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass(false));
277277
}
278278

279-
if ($definition->getFactoryService()) {
280-
$description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService());
279+
if ($definition->getFactoryService(false)) {
280+
$description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService(false));
281281
}
282282

283-
if ($definition->getFactoryMethod()) {
284-
$description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod());
283+
if ($definition->getFactoryMethod(false)) {
284+
$description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod(false));
285285
}
286286

287287
if ($factory = $definition->getFactory()) {

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ public function getDescribeContainerBuilderTestData()
6666
return $this->getContainerBuilderDescriptionTestData(ObjectsProvider::getContainerBuilders());
6767
}
6868

69+
/** @dataProvider provideLegacySynchronizedServiceDefinitionTestData */
70+
public function testLegacyDescribeSynchronizedServiceDefinition(Definition $definition, $expectedDescription)
71+
{
72+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
73+
74+
$this->assertDescription($expectedDescription, $definition);
75+
}
76+
77+
public function provideLegacySynchronizedServiceDefinitionTestData()
78+
{
79+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
80+
81+
return $this->getDescriptionTestData(ObjectsProvider::getLegacyContainerDefinitions());
82+
}
83+
6984
/** @dataProvider getDescribeContainerDefinitionTestData */
7085
public function testDescribeContainerDefinition(Definition $definition, $expectedDescription)
7186
{

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,13 @@ public static function getContainerDefinitions()
9797
->setPublic(true)
9898
->setSynthetic(false)
9999
->setLazy(true)
100-
->setSynchronized(true)
101100
->setAbstract(true)
102101
->setFactory(array('Full\\Qualified\\FactoryClass', 'get')),
103102
'definition_2' => $definition2
104103
->setPublic(false)
105104
->setSynthetic(true)
106105
->setFile('/path/to/file')
107106
->setLazy(false)
108-
->setSynchronized(false)
109107
->setAbstract(false)
110108
->addTag('tag1', array('attr1' => 'val1', 'attr2' => 'val2'))
111109
->addTag('tag1', array('attr3' => 'val3'))
@@ -114,6 +112,39 @@ public static function getContainerDefinitions()
114112
);
115113
}
116114

115+
/**
116+
* @deprecated since version 2.7, to be removed in 3.0
117+
* @internal
118+
*/
119+
public static function getLegacyContainerDefinitions()
120+
{
121+
$definition1 = new Definition('Full\\Qualified\\Class1');
122+
$definition2 = new Definition('Full\\Qualified\\Class2');
123+
124+
return array(
125+
'legacy_synchronized_service_definition_1' => $definition1
126+
->setPublic(true)
127+
->setSynthetic(false)
128+
->setLazy(true)
129+
->setSynchronized(true)
130+
->setAbstract(true)
131+
->setFactoryClass('Full\\Qualified\\FactoryClass', 'get')
132+
->setFactoryMethod('get'),
133+
'legacy_synchronized_service_definition_2' => $definition2
134+
->setPublic(false)
135+
->setSynthetic(true)
136+
->setFile('/path/to/file')
137+
->setLazy(false)
138+
->setSynchronized(false)
139+
->setAbstract(false)
140+
->addTag('tag1', array('attr1' => 'val1', 'attr2' => 'val2'))
141+
->addTag('tag1', array('attr3' => 'val3'))
142+
->addTag('tag2')
143+
->setFactoryService('factory.service')
144+
->setFactoryMethod('get'),
145+
);
146+
}
147+
117148
public static function getContainerAliases()
118149
{
119150
return array(

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"public": true,
77
"synthetic": false,
88
"lazy": true,
9-
"synchronized": true,
9+
"synchronized": false,
1010
"abstract": true,
1111
"file": null,
1212
"factory_class": "Full\\Qualified\\FactoryClass",

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ definition_1
1212
- Public: yes
1313
- Synthetic: no
1414
- Lazy: yes
15-
- Synchronized: yes
15+
- Synchronized: no
1616
- Abstract: yes
1717
- Factory Class: `Full\Qualified\FactoryClass`
1818
- Factory Method: `get`
@@ -37,4 +37,4 @@ alias_2
3737
Services
3838
--------
3939
40-
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
40+
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<container>
33
<alias id="alias_1" service="service_1" public="true"/>
44
<alias id="alias_2" service="service_2" public="false"/>
5-
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="true" abstract="true" file="">
5+
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
66
<factory class="Full\Qualified\FactoryClass" method="get"/>
77
</definition>
88
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"public": true,
77
"synthetic": false,
88
"lazy": true,
9-
"synchronized": true,
9+
"synchronized": false,
1010
"abstract": true,
1111
"file": null,
1212
"factory_class": "Full\\Qualified\\FactoryClass",

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ definition_1
1212
- Public: yes
1313
- Synthetic: no
1414
- Lazy: yes
15-
- Synchronized: yes
15+
- Synchronized: no
1616
- Abstract: yes
1717
- Factory Class: `Full\Qualified\FactoryClass`
1818
- Factory Method: `get`
@@ -57,4 +57,4 @@ alias_2
5757
Services
5858
--------
5959

60-
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
60+
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<container>
33
<alias id="alias_1" service="service_1" public="true"/>
44
<alias id="alias_2" service="service_2" public="false"/>
5-
<definition id="definition_1" cla 57AE ss="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="true" abstract="true" file="">
5+
<definition id="definition_1" class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
66
<factory class="Full\Qualified\FactoryClass" method="get"/>
77
</definition>
88
<definition id="definition_2" class="Full\Qualified\Class2" scope="container" public="false" synthetic="true" lazy="false" synchronized="false" abstract="false" file="/path/to/file">

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"public": true,
55
"synthetic": false,
66
"lazy": true,
7-
"synchronized": true,
7+
"synchronized": false,
88
"abstract": true,
99
"file": null,
1010
"factory_class": "Full\\Qualified\\FactoryClass",

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- Public: yes
44
- Synthetic: no
55
- Lazy: yes
6-
- Synchronized: yes
6+
- Synchronized: no
77
- Abstract: yes
88
- Factory Class: `Full\Qualified\FactoryClass`
9-
- Factory Method: `get`
9+
- Factory Method: `get`

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<comment>Public</comment> yes
66
<comment>Synthetic</comment> no
77
<comment>Lazy</comment> yes
8-
<comment>Synchronized</comment> yes
8+
<comment>Synchronized</comment> no
99
<comment>Abstract</comment> yes
1010
<comment>Factory Class</comment> Full\Qualified\FactoryClass
1111
<comment>Factory Method</comment> get
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="true" abstract="true" file="">
2+
<definition class="Full\Qualified\Class1" scope="container" public="true" synthetic="false" lazy="true" synchronized="false" abstract="true" file="">
33
<factory class="Full\Qualified\FactoryClass" method="get"/>
44
</definition>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"class": "Full\\Qualified\\Class1",
3+
"scope": "container",
4+
"public": true,
5+
"synthetic": false,
6+
"lazy": true,
7+
"synchronized": true,
8+
"abstract": true,
9+
"file": null,
10+
"factory_class": "Full\\Qualified\\FactoryClass",
11+
"factory_method": "get",
12+
"tags": [
13+
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- Class: `Full\Qualified\Class1`
2+
- Scope: `container`
3+
- Public: yes
4+
- Synthetic: no
5+
- Lazy: yes
6+
- Synchronized: yes
7+
- Abstract: yes
8+
- Factory Class: `Full\Qualified\FactoryClass`
9+
- Factory Method: `get`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<comment>Service Id</comment> -
2+
<comment>Class</comment> Full\Qualified\Class1
3+
<comment>Tags</comment> -
4+
<comment>Scope</comment> container
5+
<comment>Public</comment> yes
6+
<comment>Synthetic</comment> no
7+
<comment>Lazy</comment> yes
8+
<comment>Synchronized</comment> yes
9+
<comment>Abstract</comment> yes
10+
<comment>Factory Class</comment> Full\Qualified\FactoryClass
11+
<comment>Factory Method</comment> get
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<definition class="Full\Qualified\Class1" factory-class="Full\Qualified\FactoryClass" factory-method="get" scope="container" public="true" synthetic="false" lazy="true" synchronized="true" abstract="true" file=""/>

0 commit comments

Comments
 (0)
0