Skip to content

Commit e5b0fd3

Browse files
committed
properly describe service definitions without class
1 parent 7e5dfcf commit e5b0fd3

21 files changed

+147
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private function getContainerDefinitionData(Definition $definition, bool $omitTa
220220
'autoconfigure' => $definition->isAutoconfigured(),
221221
];
222222

223-
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
223+
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
224224
$data['description'] = $classDescription;
225225
}
226226

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
183183
{
184184
$output = '';
185185

186-
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
186+
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
187187
$output .= '- Description: `'.$classDescription.'`'."\n";
188188
}
189189

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
255255
$options['output']->title(sprintf('Information for Service "<info>%s</info>"', $options['id']));
256256
}
257257

258-
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
258+
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
259259
$options['output']->text($classDescription."\n");
260260
}
261261

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function getContainerDefinitionDocument(Definition $definition, string $
304304
$serviceXML->setAttribute('id', $id);
305305
}
306306

307-
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
307+
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
308308
$serviceXML->appendChild($descriptionXML = $dom->createElement('description'));
309309
$descriptionXML->appendChild($dom->createCDATASection($classDescription));
310310
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public static function getContainerDefinitions()
139139
->addTag('tag2')
140140
->addMethodCall('setMailer', [new Reference('mailer')])
141141
->setFactory([new Reference('factory.service'), 'get']),
142+
'definition_without_class' => new Definition(),
142143
];
143144
}
144145

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@
6767
"factory_method": "get",
6868
"tags": []
6969
},
70+
"definition_without_class": {
71+
"class": "",
72+
"public": false,
73+
"synthetic": false,
74+
"lazy": false,
75+
"shared": true,
76+
"abstract": false,
77+
"autowire": false,
78+
"autoconfigure": false,
79+
"arguments": [],
80+
"file": null,
81+
"tags": []
82+
},
7083
"service_container": {
7184
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
7285
"public": true,

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ Definitions
1818
- Factory Class: `Full\Qualified\FactoryClass`
1919
- Factory Method: `get`
2020

21+
### definition_without_class
22+
23+
- Class: ``
24+
- Public: no
25+
- Synthetic: no
26+
- Lazy: no
27+
- Shared: yes
28+
- Abstract: no
29+
- Autowired: no
30+
- Autoconfigured: no
31+
- Arguments: no
32+
2133
### service_container
2234

2335
- Description: `ContainerInterface is the interface implemented by service container classes.`

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
Symfony Container Services
33
==========================
44

5-
------------------- ----------------------------------------------------------
6-
 Service ID   Class name 
7-
------------------- ----------------------------------------------------------
8-
alias_1 alias for "service_1"
9-
definition_1 Full\Qualified\Class1
10-
service_container Symfony\Component\DependencyInjection\ContainerInterface
11-
------------------- ----------------------------------------------------------
5+
-------------------------- ----------------------------------------------------------
6+
 Service ID   Class name 
7+
-------------------------- ----------------------------------------------------------
8+
alias_1 alias for "service_1"
9+
definition_1 Full\Qualified\Class1
10+
definition_without_class
11+
service_container Symfony\Component\DependencyInjection\ContainerInterface
12+
-------------------------- ----------------------------------------------------------
1213

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<argument type="service" id=".definition_2"/>
2424
</argument>
2525
</definition>
26+
<definition id="definition_without_class" class="" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
2627
<definition id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
2728
<description><![CDATA[ContainerInterface is the interface implemented by service container classes.]]></description>
2829
</definition>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@
1414
"factory_method": "get",
1515
"tags": []
1616
},
17+
"definition_without_class": {
18+
"class": "",
19+
"public": false,
20+
"synthetic": false,
21+
"lazy": false,
22+
"shared": true,
23+
"abstract": false,
24+
"autowire": false,
25+
"autoconfigure": false,
26+
"file": null,
27+
"tags": []
28+
},
1729
"service_container": {
1830
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
1931
"public": true,

0 commit comments

Comments
 (0)