Commit f929439
feat: more readable phpdoc escaping (#11208)
The PHPDoc escaping in PHP is aggressive in that it escapes some character sequences that don't need to be escaped (`/*`), and it uses HTML entities to escape others (`*/` and `@`) instead of the recommended PHPDoc escape sequences.
For Example, in [`Google\Api\RoutingParameter`](https://github.com/googleapis/common-protos-php/blob/main/src/Api/RoutingParameter.php#L42):
```
* path_template: "projects/*/{table_location=instances/*}/tables/*"
```
Should be escaped as:
```
* path_template: "projects/{@*}{table_location=instances/*}/tables/*"
```
according to [the PHPDoc guide](https://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.desc):
- For `@`: "if you need an actual "@" in your DocBlock's description parts, you should be careful to either ensure it is not the first character on a line, or else escape it ("\\@") to avoid it being interpreted as a PhpDocumentor tag marker."
- For `*/`: " If you need to use the closing comment "\*/" in a DocBlock, use the special escape sequence "{@*}."
Closes #11208
COPYBARA_INTEGRATE_REVIEW=#11208 from bshaffer:more-readable-phpdoc-escaping a75f974
PiperOrigin-RevId: 6030916421 parent f8ea418 commit f929439
File tree
3 files changed
+47
-16
lines changed- php/tests
- proto
- src/google/protobuf/compiler/php
3 files changed
+47
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
1906 | 1907 | | |
1907 | 1908 | | |
1908 | 1909 | | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
1909 | 1931 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1556 | 1556 | | |
1557 | 1557 | | |
1558 | 1558 | | |
1559 | | - | |
| 1559 | + | |
1560 | 1560 | | |
1561 | 1561 | | |
1562 | 1562 | | |
1563 | 1563 | | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
1568 | | - | |
1569 | | - | |
1570 | | - | |
1571 | | - | |
| 1564 | + | |
1572 | 1565 | | |
1573 | | - | |
| 1566 | + | |
1574 | 1567 | | |
1575 | | - | |
| 1568 | + | |
| 1569 | + | |
1576 | 1570 | | |
1577 | 1571 | | |
1578 | 1572 | | |
1579 | 1573 | | |
1580 | 1574 | | |
1581 | | - | |
1582 | | - | |
1583 | | - | |
1584 | | - | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
1585 | 1578 | | |
1586 | 1579 | | |
1587 | 1580 | | |
1588 | 1581 | | |
1589 | 1582 | | |
1590 | | - | |
1591 | 1583 | | |
1592 | 1584 | | |
1593 | 1585 | | |
| |||
0 commit comments