bug #30641 [FrameworkBundle] properly describe service definitions without class (xabbuh)

This PR was merged into the 4.2 branch.

Discussion
----------

[FrameworkBundle] properly describe service definitions without class

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30638
| License       | MIT
| Doc PR        |

Commits
-------

e5b0fd37f6 properly describe service definitions without class
This commit is contained in:
Fabien Potencier 2019-03-26 11:37:02 +01:00
commit 8d7e002168
21 changed files with 147 additions and 18 deletions

View File

@ -220,7 +220,7 @@ class JsonDescriptor extends Descriptor
'autoconfigure' => $definition->isAutoconfigured(),
];
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
$data['description'] = $classDescription;
}

View File

@ -183,7 +183,7 @@ class MarkdownDescriptor extends Descriptor
{
$output = '';
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
$output .= '- Description: `'.$classDescription.'`'."\n";
}

View File

@ -255,7 +255,7 @@ class TextDescriptor extends Descriptor
$options['output']->title(sprintf('Information for Service "<info>%s</info>"', $options['id']));
}
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
$options['output']->text($classDescription."\n");
}

View File

@ -304,7 +304,7 @@ class XmlDescriptor extends Descriptor
$serviceXML->setAttribute('id', $id);
}
if ('' !== $classDescription = $this->getClassDescription($definition->getClass())) {
if ('' !== $classDescription = $this->getClassDescription((string) $definition->getClass())) {
$serviceXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createCDATASection($classDescription));
}

View File

@ -139,6 +139,7 @@ class ObjectsProvider
->addTag('tag2')
->addMethodCall('setMailer', [new Reference('mailer')])
->setFactory([new Reference('factory.service'), 'get']),
'definition_without_class' => new Definition(),
];
}

View File

@ -67,6 +67,19 @@
"factory_method": "get",
"tags": []
},
"definition_without_class": {
"class": "",
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
"abstract": false,
"autowire": false,
"autoconfigure": false,
"arguments": [],
"file": null,
"tags": []
},
"service_container": {
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
"public": true,

View File

@ -18,6 +18,18 @@ Definitions
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
### definition_without_class
- Class: ``
- Public: no
- Synthetic: no
- Lazy: no
- Shared: yes
- Abstract: no
- Autowired: no
- Autoconfigured: no
- Arguments: no
### service_container
- Description: `ContainerInterface is the interface implemented by service container classes.`

View File

@ -2,11 +2,12 @@
Symfony Container Services
==========================
------------------- ----------------------------------------------------------
 Service ID   Class name 
------------------- ----------------------------------------------------------
alias_1 alias for "service_1"
definition_1 Full\Qualified\Class1
service_container Symfony\Component\DependencyInjection\ContainerInterface
------------------- ----------------------------------------------------------
-------------------------- ----------------------------------------------------------
 Service ID   Class name 
-------------------------- ----------------------------------------------------------
alias_1 alias for "service_1"
definition_1 Full\Qualified\Class1
definition_without_class
service_container Symfony\Component\DependencyInjection\ContainerInterface
-------------------------- ----------------------------------------------------------

View File

@ -23,6 +23,7 @@
<argument type="service" id=".definition_2"/>
</argument>
</definition>
<definition id="definition_without_class" class="" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
<definition id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
<description><![CDATA[ContainerInterface is the interface implemented by service container classes.]]></description>
</definition>

View File

@ -14,6 +14,18 @@
"factory_method": "get",
"tags": []
},
"definition_without_class": {
"class": "",
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
"abstract": false,
"autowire": false,
"autoconfigure": false,
"file": null,
"tags": []
},
"service_container": {
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
"public": true,

View File

@ -17,6 +17,17 @@ Definitions
- Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get`
### definition_without_class
- Class: ``
- Public: no
- Synthetic: no
- Lazy: no
- Shared: yes
- Abstract: no
- Autowired: no
- Autoconfigured: no
### service_container
- Description: `ContainerInterface is the interface implemented by service container classes.`

View File

@ -2,11 +2,12 @@
Symfony Container Services
==========================
------------------- ----------------------------------------------------------
 Service ID   Class name 
------------------- ----------------------------------------------------------
alias_1 alias for "service_1"
definition_1 Full\Qualified\Class1
service_container Symfony\Component\DependencyInjection\ContainerInterface
------------------- ----------------------------------------------------------
-------------------------- ----------------------------------------------------------
 Service ID   Class name 
-------------------------- ----------------------------------------------------------
alias_1 alias for "service_1"
definition_1 Full\Qualified\Class1
definition_without_class
service_container Symfony\Component\DependencyInjection\ContainerInterface
-------------------------- ----------------------------------------------------------

View File

@ -4,6 +4,7 @@
<definition id="definition_1" class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" autoconfigured="false" file="">
<factory class="Full\Qualified\FactoryClass" method="get"/>
</definition>
<definition id="definition_without_class" class="" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
<definition id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
<description><![CDATA[ContainerInterface is the interface implemented by service container classes.]]></description>
</definition>

View File

@ -0,0 +1,13 @@
{
"class": "",
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
"abstract": false,
"autowire": false,
"autoconfigure": false,
"arguments": [],
"file": null,
"tags": []
}

View File

@ -0,0 +1,9 @@
- Class: ``
- Public: no
- Synthetic: no
- Lazy: no
- Shared: yes
- Abstract: no
- Autowired: no
- Autoconfigured: no
- Arguments: no

View File

@ -0,0 +1,15 @@
---------------- -------
 Option   Value 
---------------- -------
Service ID -
Class -
Tags -
Public no
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
---------------- -------

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>

View File

@ -0,0 +1,12 @@
{
"class": "",
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
"abstract": false,
"autowire": false,
"autoconfigure": false,
"file": null,
"tags": []
}

View File

@ -0,0 +1,8 @@
- Class: ``
- Public: no
- Synthetic: no
- Lazy: no
- Shared: yes
- Abstract: no
- Autowired: no
- Autoconfigured: no

View File

@ -0,0 +1,15 @@
---------------- -------
 Option   Value 
---------------- -------
Service ID -
Class -
Tags -
Public no
Synthetic no
Lazy no
Shared yes
Abstract no
Autowired no
Autoconfigured no
---------------- -------

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<definition class="" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>