Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 130
Add PI processing support for common phrases#173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
| if (!defined('VALUE_ERROR_BETWEEN_ERROR_SECTION')) { | ||
| define('VALUE_ERROR_BETWEEN_ERROR_SECTION', <<<'CONTENT' | ||
| <simpara xmlns="http://docbook.org/ns/docbook"> | ||
| Throws a <exceptionname>ValueError</exceptionname> if <parameter>PARAMETER_NAME</parameter> | ||
| is less than MIN_TAG or greater than MAX_TAG. | ||
| </simpara> | ||
| CONTENT | ||
| ); | ||
| } | ||
| if (!defined('VALUE_ERROR_BETWEEN_CHANGELOG')) { | ||
| define('VALUE_ERROR_BETWEEN_CHANGELOG', <<<'CONTENT' | ||
| <row xmlns="http://docbook.org/ns/docbook"> | ||
| <entry>VERSION</entry> | ||
| <entry> | ||
| A <exceptionname>ValueError</exceptionname> is now thrown if | ||
| <parameter>PARAMETER_NAME</parameter> is less than MIN_TAG | ||
| or greater than MAX_TAG | ||
| </entry> | ||
| </row> | ||
| CONTENT | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
| const VALUE_ERROR_BETWEEN_ERROR_SECTION = <<<'CONTENT' | ||
| <simpara> | ||
| Lance une <exceptionname>ValueError</exceptionname> si <parameter>PARAMETER_NAME</parameter> | ||
| est moins que MIN_TAG ou plus grand que MAX_TAG. | ||
| </simpara> | ||
| CONTENT; | ||
| const VALUE_ERROR_BETWEEN_CHANGELOG = <<<'CONTENT' | ||
| <row> | ||
| <entry>VERSION</entry> | ||
| <entry> | ||
| Une <exceptionname>ValueError</exceptionname> est désormais lancé si | ||
| <parameter>PARAMETER_NAME</parameter> est moins que MIN_TAG ou plus grand que MAX_TAG | ||
| </entry> | ||
| </row> | ||
| CONTENT; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?php | ||
| function error_section_value_error_between( | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some duplication between these functions which would be nice to somehow get rid of; at least it should be possible to move the import to the caller. Note that there's also an | ||
| string $parameter, | ||
| string $min, | ||
| string $max | ||
| ): string { | ||
| $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 . '>'; | ||
| return str_replace( | ||
Girgias marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ['PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'], | ||
| [$parameter, $min_tag, $max_tag], | ||
| VALUE_ERROR_BETWEEN_ERROR_SECTION, | ||
| ); | ||
| } | ||
| function error_section_value_error_between_changelog( | ||
| string $version, | ||
| string $parameter, | ||
| string $min, | ||
| string $max | ||
| ): string { | ||
| $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 . '>'; | ||
| return str_replace( | ||
| ['VERSION', 'PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'], | ||
| [$version, $parameter, $min_tag, $max_tag], | ||
| VALUE_ERROR_BETWEEN_CHANGELOG, | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplication with
str_starts_with?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because we have a bunch of PI instruction that are just
phpdocand those that will generate documentation node have more complicated names, so the target is effectively the instruction and the data are values to pass to the corresponding function.Maybe this design is crap, but I didn't want to figure out how to parse the function to call