Skip to content

Commit e955e29

Browse files
committed
[BUGFIX] do not parse version config node
1 parent 075539c commit e955e29

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

packages/guides/src/DependencyInjection/GuidesExtension.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function getConfigTreeBuilder(): TreeBuilder
5959
->arrayNode('project')
6060
->children()
6161
->scalarNode('title')->end()
62-
->scalarNode('version')
62+
->variableNode('version')
6363
->beforeNormalization()
6464
->always(
6565
// We need to revert the phpize call in XmlUtils. Version is always a string!
@@ -73,7 +73,20 @@ static function ($value) {
7373
)
7474
->end()
7575
->end()
76-
->scalarNode('release')->end()
76+
->variableNode('release')
77+
->beforeNormalization()
78+
->always(
79+
// We need to revert the phpize call in XmlUtils. Version is always a string!
80+
static function ($value) {
81+
if (!is_int($value) && !is_string($value)) {
82+
return var_export($value, true);
83+
}
84+
85+
return $value;
86+
},
87+
)
88+
->end()
89+
->end()
7790
->scalarNode('copyright')->end()
7891
->end()
7992
->end()

tests/Integration/tests/configuration/config-project/expected/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>Document Title</h1>
1010
<dd>Title</dd>
1111
<dt>version:</dt>
1212

13-
<dd>12.4</dd>
13+
<dd>12.4.0</dd>
1414
<dt>release:</dt>
1515

1616
<dd>12.4.9-dev</dd>

tests/Integration/tests/configuration/config-project/input/guides.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
>
66
<project
77
title="Title"
8-
version="12.4"
8+
version="12.4.0"
99
release="12.4.9-dev"
1010
copyright="since 1998 phpDocumentor Team and Contributors"
1111
/>

0 commit comments

Comments
 (0)