Skip to content
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

feat: more readable phpdoc escaping #11208

Closed

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Dec 8, 2022

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:

 * path_template: "projects/*/{table_location=instances/*}/tables/*"

Should be escaped as:

 * path_template: "projects/{@*}{table_location=instances/*}/tables/*"

according to the PHPDoc guide:

  • 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 "{@*}."

@bshaffer bshaffer requested a review from a team as a code owner February 2, 2023 18:26
@haberman haberman added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 16, 2023
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Feb 16, 2023
@NeilMasters
Copy link

@haberman is there anything preventing this from being merged?

@haberman
Copy link
Member

@bshaffer it looks like a bunch of the tests are failing. Rebasing and re-pushing should help.

@bshaffer bshaffer force-pushed the more-readable-phpdoc-escaping branch from 542c513 to a75f974 Compare October 27, 2023 19:29
@bshaffer
Copy link
Contributor Author

@haberman sorry for the delay here. Done!

Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jan 26, 2024
@bshaffer
Copy link
Contributor Author

bshaffer commented Jan 26, 2024

This is an important feature, please don't just automatically close this

@haberman

@github-actions github-actions bot removed the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Jan 27, 2024
copybara-service bot pushed a commit that referenced this pull request Jan 31, 2024
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
FUTURE_COPYBARA_INTEGRATE_REVIEW=#11208 from bshaffer:more-readable-phpdoc-escaping a75f974
PiperOrigin-RevId: 602870442
@bshaffer bshaffer deleted the more-readable-phpdoc-escaping branch January 31, 2024 18:37
deannagarcia pushed a commit to deannagarcia/protobuf that referenced this pull request Jun 20, 2024
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/&protocolbuffers#42;&protocolbuffers#47;{table_location=instances/&protocolbuffers#42;}/tables/&protocolbuffers#42;"
```

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 protocolbuffers#11208

COPYBARA_INTEGRATE_REVIEW=protocolbuffers#11208 from bshaffer:more-readable-phpdoc-escaping a75f974
PiperOrigin-RevId: 603091642
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants