diff --git a/configure.php b/configure.php
index 17a6483b7..ab2e2873b 100755
--- a/configure.php
+++ b/configure.php
@@ -797,6 +797,34 @@ function getFileModificationHistory(): array {
}
}
+echo "Process PI nodes...\n";
+if (!$ac['LANG'] == 'en') {
+ if (file_exists($srcdir . '/pi_processing/langs/' . $ac['LANG'] . '.php')) {
+ require_once $srcdir . '/pi_processing/langs/' . $ac['LANG'] . '.php';
+ }
+}
+require_once $srcdir . '/pi_processing/langs/en.php';
+require_once $srcdir . '/pi_processing/processors.php';
+$xpath = new DOMXPath($dom);
+foreach ($xpath->query('//processing-instruction()') as $pi) {
+ if (!str_starts_with($pi->target, 'phpdoc')) {
+ continue;
+ }
+ // Don't care about generic phpdoc PI target
+ if ($pi->target === 'phpdoc') {
+ continue;
+ }
+
+ var_dump($pi->target, $pi->data);
+ $fn = match ($pi->target) {
+ 'phpdoc_error_ValueError_between' => error_section_value_error_between(...),
+ 'phpdoc_error_ValueError_between_changelog' => error_section_value_error_between_changelog(...),
+ };
+ $data = explode(' ', $pi->data);
+ $node = $fn($dom, ...$data);
+ $pi->parentNode->insertBefore($node, $pi);
+}
+
echo "Validating {$ac["INPUT_FILENAME"]}... ";
flush();
if ($ac['PARTIAL'] != '' && $ac['PARTIAL'] != 'no') { // {{{
diff --git a/pi_processing/langs/en.php b/pi_processing/langs/en.php
new file mode 100644
index 000000000..a010ff989
--- /dev/null
+++ b/pi_processing/langs/en.php
@@ -0,0 +1,25 @@
+
+ Throws a ValueError if PARAMETER_NAME
+ is less than MIN_TAG or greater than MAX_TAG.
+
+CONTENT
+ );
+}
+
+if (!defined('VALUE_ERROR_BETWEEN_CHANGELOG')) {
+ define('VALUE_ERROR_BETWEEN_CHANGELOG', <<<'CONTENT'
+
+ VERSION
+
+ A ValueError is now thrown if
+ PARAMETER_NAME is less than MIN_TAG
+ or greater than MAX_TAG
+
+
+CONTENT
+ );
+}
diff --git a/pi_processing/langs/fr.php b/pi_processing/langs/fr.php
new file mode 100644
index 000000000..78b3dcf04
--- /dev/null
+++ b/pi_processing/langs/fr.php
@@ -0,0 +1,18 @@
+
+ Lance une ValueError si PARAMETER_NAME
+ est moins que MIN_TAG ou plus grand que MAX_TAG.
+
+CONTENT;
+
+const VALUE_ERROR_BETWEEN_CHANGELOG = <<<'CONTENT'
+
+ VERSION
+
+ Une ValueError est désormais lancé si
+ PARAMETER_NAME est moins que MIN_TAG ou plus grand que MAX_TAG
+
+
+CONTENT;
diff --git a/pi_processing/processors.php b/pi_processing/processors.php
new file mode 100644
index 000000000..d07f71e43
--- /dev/null
+++ b/pi_processing/processors.php
@@ -0,0 +1,46 @@
+' . $min . '' . $min_tag_name . '>';
+ $max_tag = '<' . $max_tag_name . '>' . $max . '' . $max_tag_name . '>';
+
+ $xml = str_replace(
+ ['PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'],
+ [$parameter, $min_tag, $max_tag],
+ VALUE_ERROR_BETWEEN_ERROR_SECTION,
+ );
+ $localDom = new DOMDocument();
+ $localDom->loadXML($xml);
+ return $dom->importNode($localDom->documentElement, true);
+}
+
+function error_section_value_error_between_changelog(
+ DOMDocument $dom,
+ string $version,
+ string $parameter,
+ string $min,
+ string $max
+): DOMElement {
+ $min_tag_name = is_numeric($min) ? 'literal' : 'constant';
+ $max_tag_name = is_numeric($max) ? 'literal' : 'constant';
+
+ $min_tag = '<' . $min_tag_name . '>' . $min . '' . $min_tag_name . '>';
+ $max_tag = '<' . $max_tag_name . '>' . $max . '' . $max_tag_name . '>';
+
+ $xml = str_replace(
+ ['VERSION', 'PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'],
+ [$version, $parameter, $min_tag, $max_tag],
+ VALUE_ERROR_BETWEEN_CHANGELOG,
+ );
+ $localDom = new DOMDocument();
+ $localDom->loadXML($xml);
+ return $dom->importNode($localDom->documentElement, true);
+}