Skip to content

Commit

Permalink
[BUGFIX] Allow escaped version
Browse files Browse the repository at this point in the history
symfony is trying to normalize the xml input using
some logic. However in our case we want to fetch the raw value for version. But this is not possible. therefor an escape system is added by adding `'`.
  • Loading branch information
jaapio committed Sep 4, 2024
1 parent 075539c commit 95a4e82
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
25 changes: 23 additions & 2 deletions packages/guides/src/DependencyInjection/GuidesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->arrayNode('project')
->children()
->scalarNode('title')->end()
->scalarNode('version')
->node('version', 'scalar')
->beforeNormalization()
->always(
// We need to revert the phpize call in XmlUtils. Version is always a string!
Expand All @@ -68,12 +68,33 @@ static function ($value) {
return var_export($value, true);
}

if (is_string($value)) {
return trim($value, "'");

Check failure on line 72 in packages/guides/src/DependencyInjection/GuidesExtension.php

View workflow job for this annotation

GitHub Actions / Coding Standards

Function trim() should not be referenced via a fallback global name, but via a use statement.
}

return $value;
},
)
->end()
->end()
->node('release', 'scalar')
->beforeNormalization()
->always(
// We need to revert the phpize call in XmlUtils. Version is always a string!
static function ($value) {
if (!is_int($value) && !is_string($value)) {
return var_export($value, true);
}

if (is_string($value)) {
return trim($value, "'");

Check failure on line 90 in packages/guides/src/DependencyInjection/GuidesExtension.php

View workflow job for this annotation

GitHub Actions / Coding Standards

Function trim() should not be referenced via a fallback global name, but via a use statement.
}

return $value;
},
)
->end()
->end()
->scalarNode('release')->end()
->scalarNode('copyright')->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>Document Title</h1>
<dd>Title</dd>
<dt>version:</dt>

<dd>12.4</dd>
<dd>12.4.0</dd>
<dt>release:</dt>

<dd>12.4.9-dev</dd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<project
title="Title"
version="12.4"
version="12.4.0"
release="12.4.9-dev"
copyright="since 1998 phpDocumentor Team and Contributors"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<project
title="Render guides"
version="3.0"
version="'3.0'"
release="3.0.0"
/>
</guides>

0 comments on commit 95a4e82

Please sign in to comment.