8000 Merge branch '2.5' into 2.6 · symfony/symfony@4308bd8 · GitHub
[go: up one dir, main page]

Skip to content
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

Appearance settings

Commit 4308bd8

Browse files
committed
Merge branch '2.5' into 2.6
* 2.5: [FrameworkBundle] fixed missing information in some descriptors
2 parents d00a435 + b5c2600 commit 4308bd8

25 files changed

+175
-27
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,15 @@ protected function getRouteData(Route $route)
188188

189189
return array(
190190
'path' => $route->getPath(),
191+
'pathRegex' => $route->compile()->getRegex(),
191192
'host' => '' !== $route->getHost() ? $route->getHost() : 'ANY',
193+
'hostRegex' => '' !== $route->getHost() ? $route->compile()->getHostRegex() : '',
192194
'scheme' => $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY',
193195
'method' => $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY',
194196
'class' => get_class($route),
195197
'defaults' => $route->getDefaults(),
196198
'requirements' => $requirements ?: 'NO CUSTOM',
197199
'options' => $route->getOptions(),
198-
'pathRegex' => $route->compile()->getRegex(),
199200
);
200201
}
201202

@@ -212,9 +213,24 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
212213
'scope' => $definition->getScope(),
213214
'public' => $definition->isPublic(),
214215
'synthetic' => $definition->isSynthetic(),
216+
'lazy' => $definition->isLazy(),
217+
'synchronized' => $definition->isSynchronized(),
218+
'abstract' => $definition->isSynchronized(),
215219
'file' => $definition->getFile(),
216220
);
217221

222+
if ($definition->getFactoryClass()) {
223+
$data['factory_class'] = $definition->getFactoryClass();
224+
}
225+
226+
if ($definition->getFactoryService()) {
227+
$data['factory_service'] = $definition->getFactoryService();
228+
}
229+
230+
if ($definition->getFactoryMethod()) {
231+
$data['factory_method'] = $definition->getFactoryMethod();
232+
}
233+
218234
if (!$omitTags) {
219235
$data['tags'] = array();
220236
if (count($definition->getTags())) {

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ protected function describeRoute(Route $route, array $options = array())
5252
unset($requirements['_scheme'], $requirements['_method']);
5353

5454
$output = '- Path: '.$route->getPath()
55+
."\n".'- Path Regex: '.$route->compile()->getRegex()
5556
."\n".'- Host: '.('' !== $route->getHost() ? $route->getHost() : 'ANY')
57+
."\n".'- Host Regex: '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')
5658
."\n".'- Scheme: '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')
5759
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
5860
."\n".'- Class: '.get_class($route)
5961
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
6062
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
61-
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions())
62-
."\n".'- Path-Regex: '.$route->compile()->getRegex();
63+
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
6364

6465
$this->write(isset($options['name'])
6566
? $options['name']."\n".str_repeat('-', strlen($options['name']))."\n\n".$output
@@ -179,12 +180,27 @@ protected function describeContainerDefinition(Definition $definition, array $op
179180
$output = '- Class: `'.$definition->getClass().'`'
180181
."\n".'- Scope: `'.$definition->getScope().'`'
181182
."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
182-
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no');
183+
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
184+
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
185+
."\n".'- Synchronized: '.($definition->isSynchronized() ? 'yes' : 'no')
186+
."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no');
183187

184188
if ($definition->getFile()) {
185189
$output .= "\n".'- File: `'.$definition->getFile().'`';
186190
}
187191

192+
if ($definition->getFactoryClass()) {
193+
$output .= "\n".'- Factory Class: `'.$definition->getFactoryClass().'`';
194+
}
195+
196+
if ($definition->getFactoryService()) {
197+
$output .= "\n".'- Factory Service: `'.$definition->getFactoryService().'`';
198+
}
199+
200+
if ($definition->getFactoryMethod()) {
201+
$output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod().'`';
202+
}
203+
188204
if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
189205
foreach ($definition->getTags() as $tagName => $tagData) {
190206
foreach ($tagData as $parameters) {

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,22 @@ protected function describeRoute(Route $route, array $options = array())
7575
// fixme: values were originally written as raw
7676
$description = array(
7777
'<comment>Path</comment> '.$route->getPath(),
78+
'<comment>Path Regex</comment> '.$route->compile()->getRegex(),
7879
'<comment>Host</comment> '.('' !== $route->getHost() ? $route->getHost() : 'ANY'),
80+
'<comment>Host Regex</comment> '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : ''),
7981
'<comment>Scheme</comment> '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY'),
8082
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
8183
'<comment>Class</comment> '.get_class($route),
8284
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
8385
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
8486
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
85-
'<comment>Path-Regex</comment> '.$route->compile()->getRegex(),
8687
);
8788

8889
if (isset($options['name'])) {
8990
array_unshift($description, '<comment>Name</comment> '.$options['name']);
9091
array_unshift($description, $this->formatSection('router', sprintf('Route "%s"', $options['name'])));
9192
}
9293

93-
if (null !== $route->compile()->getHostRegex()) {
94-
$description[] = '<comment>Host-Regex</comment> '.$route->compile()->getHostRegex();
95-
}
96-
9794
$this->writeText(implode("\n", $description)."\n", $options);
9895
}
9996

@@ -266,7 +263,25 @@ protected function describeContainerDefinition(Definition $definition, array $op
266263
$description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope());
267264
$description[] = sprintf('<comment>Public</comment> %s', $definition->isPublic() ? 'yes' : 'no');
268265
$description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
269-
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
266+
$description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
267+
$description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized() ? 'yes' : 'no');
268+
$description[] = sprintf('<comment>Abstract</comment> %s', $definition->isAbstract() ? 'yes' : 'no');
269+
270+
if ($definition->getFile()) {
271+
$description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
272+
}
273+
274+
if ($definition->getFactoryClass()) {
275+
$description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass());
276+
}
277+
278+
if ($definition->getFactoryService()) {
279+
$description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService());
280+
}
281+
282+
if ($definition->getFactoryMethod()) {
283+
$description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod());
284+
}
270285

271286
$this->writeText(implode("\n", $description)."\n", $options);
272287
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": true,
77
"synthetic": false,
8+
"lazy": true,
9+
"synchronized": true,
10+
"abstract": true,
811
"file": null,
12+
"factory_class": "Full\\Qualified\\FactoryClass",
13+
"factory_method": "get",
914
"tags": [
1015

1116
]

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ definition_1
1111
- Scope: `container`
1212
- Public: yes
1313
- Synthetic: no
14+
- Lazy: yes
15+
- Synchronized: yes
16+
- Abstract: yes
17+
- Factory Class: `Full\Qualified\FactoryClass`
18+
- Factory Method: `get`
1419
1520
1621
Aliases

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": true,
77
"synthetic": false,
8+
"lazy": true,
9+
"synchronized": true,
10+
"abstract": true,
811
"file": null,
12+
"factory_class": "Full\\Qualified\\FactoryClass",
13+
"factory_method": "get",
914
"tags": [
1015

1116
]
@@ -15,7 +20,12 @@
1520
"scope": "container",
1621
"public": false,
1722
"synthetic": true,
23+
"lazy": false,
24+
"synchronized": false,
25+
"abstract": false,
1826
"file": "\/path\/to\/file",
27+
"factory_service": "factory.service",
28+
"factory_method": "get",
1929
"tags": [
2030
{
2131
"name": "tag1",

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ definition_1
1111
- Scope: `container`
1212
- Public: yes
1313
- Synthetic: no
14+
- Lazy: yes
15+
- Synchronized: yes
16+
- Abstract: yes
17+
- Factory Class: `Full\Qualified\FactoryClass`
18+
- Factory Method: `get`
1419
1520
definition_2
1621
~~~~~~~~~~~~
@@ -19,7 +24,12 @@ definition_2
1924
- Scope: `container`
2025
- Public: no
2126
- Synthetic: yes
27+
- Lazy: no
28+
- Synchronized: no
29+
- Abstract: no
2230
- File: `/path/to/file`
31+
- Factory Service: `factory.service`
32+
- Factory Method: `get`
2333
- Tag: `tag1`
2434
- Attr1: val1
2535
- Attr2: val2

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": false,
77
"synthetic": true,
8+
"lazy": false,
9+
"synchronized": false,
10+
"abstract": false,
811
"file": "\/path\/to\/file",
12+
"factory_service": "factory.service",
13+
"factory_method": "get",
914
"tags": [
1015
{
1116
"name": "tag1",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ definition_2
1111
- Scope: `container`
1212
- Public: no
1313
- Synthetic: yes
14+
- Lazy: no
15+
- Synchronized: no
16+
- Abstract: no
1417
- File: `/path/to/file`
18+
- Factory Service: `factory.service`
19+
- Factory Method: `get`
1520
- Tag: `tag1`
1621
- Attr1: val1
1722
- Attr2: val2

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"scope": "container",
66
"public": false,
77
"synthetic": true,
8-
"file": "\/path\/to\/file"
8+
"lazy": false,
9+
"synchronized": false,
10+
"abstract": false,
11+
"file": "\/path\/to\/file",
12+
"factory_service": "factory.service",
13+
"factory_method": "get"
914
}
1015
],
1116
"tag2": [
@@ -14,7 +19,12 @@
1419
"scope": "container",
1520
"public": false,
1621
"synthetic": true,
17-
"file": "\/path\/to\/file"
22+
"lazy": false,
23+
"synchronized": false,
24+
"abstract": false,
25+
"file": "\/path\/to\/file",
26+
"factory_service": "factory.service",
27+
"factory_method": "get"
1828
}
1929
]
2030
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ definition_2
1111
- Scope: `container`
1212
- Public: no
1313
- Synthetic: yes
14+
- Lazy: no
15+
- Synchronized: no
16+
- Abstract: no
1417
- File: `/path/to/file`
18+
- Factory Service: `factory.service`
19+
- Factory Method: `get`
1520
1621
1722
tag2
@@ -24,4 +29,9 @@ definition_2
2429
- Scope: `container`
2530
- Public: no
2631
- Synthetic: yes
32+
- Lazy: no
33+
- Synchronized: no
34+
- Abstract: no
2735
- File: `/path/to/file`
36+
- Factory Service: `factory.service`
37+
- Factory Method: `get`

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"scope": "container",
44
"public": true,
55
"synthetic": false,
6+
"lazy": true,
7+
"synchronized": true,
8+
"abstract": true,
69
"file": null,
10+
"factory_class": "Full\\Qualified\\FactoryClass",
11+
"factory_method": "get",
712
"tags": [
813

914
]

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

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

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
<comment>Scope</comment> container
55
<comment>Public</comment> yes
66
<comment>Synthetic</comment> no
7-
<comment>Required File</comment> -
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

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"scope": "container",
44
"public": false,
55
"synthetic": true,
6+
"lazy": false,
7+
"synchronized": false,
8+
"abstract": false,
69
"file": "\/path\/to\/file",
10+
"factory_service": "factory.service",
11+
"factory_method": "get",
712
"tags": [
813
{
914
"name": "tag1",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
- Scope: `container`
33
- Public: no
44
- Synthetic: yes
5+
- Lazy: no
6+
- Synchronized: no
7+
- Abstract: no
58
- File: `/path/to/file`
9+
- Factory Service: `factory.service`
10+
- Factory Method: `get`
611
- Tag: `tag1`
712
- Attr1: val1
813
- Attr2: val2

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
<comment>Scope</comment> container
88
<comment>Public</comment> no
99
<comment>Synthetic</comment> yes
10+
<comment>Lazy</comment> no
11+
<comment>Synchronized</comment> no
12+
<comment>Abstract</comment> no
1013
<comment>Required File</comment> /path/to/file
14+
<comment>Factory Service</comment> factory.service
15+
<comment>Factory Method</comment> get

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"path": "\/hello\/{name}",
3+
"pathRegex": "#^\/hello(?:\/(?P<name>[a-z]+))?$#s",
34
"host": "localhost",
5+
"hostRegex": "#^localhost$#s",
46
"scheme": "http|https",
57
"method": "GET|HEAD",
68
"class": "Symfony\\Component\\Routing\\Route",
@@ -14,6 +16,5 @@
1416
"compiler_class": "Symfony\\Component\\Routing\\RouteCompiler",
1517
"opt1": "val1",
1618
"opt2": "val2"
17-
},
18-
"pathRegex": "#^\/hello(?:\/(?P<name>[a-z]+))?$#s"
19+
}
1920
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- Path: /hello/{name}
2+
- Path Regex: #^/hello(?:/(?P<name>[a-z]+))?$#s
23
- Host: localhost
4+
- Host Regex: #^localhost$#s
35
- Scheme: http|https
46
- Method: GET|HEAD
57
- Class: Symfony\Component\Routing\Route

0 commit comments

Comments
 (0)
0