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 274175b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
24 changes: 23 additions & 1 deletion packages/guides/src/DependencyInjection/GuidesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use function is_int;
use function is_string;
use function pathinfo;
use function trim;
use function var_export;

final class GuidesExtension extends Extension implements CompilerPassInterface, ConfigurationInterface, PrependExtensionInterface
Expand All @@ -68,12 +69,33 @@ static function ($value) {
return var_export($value, true);
}

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

return $value;
},
)
->end()
->end()
->scalarNode('release')
->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, "'");
}

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 274175b

Please sign in to comment.