PHP: Support variadic marked variables in PHPDoc#9487
Conversation
|
@junichi11 @tmysik it would be great if you could have a look. |
| ArrayList<String> types = new ArrayList<>(); | ||
| if (tokens.length > 0 && (isReturnTag(tagType) || !tokens[0].startsWith("$"))) { //NOI18N | ||
| if (tokens.length > 0 && (isReturnTag(tagType) | ||
| || !(tokens[0].startsWith("$") /* variable */ || tokens[0].startsWith("...$") /* variadic variable */ ))) { //NOI18N |
There was a problem hiding this comment.
Just braninstorming - would it make sense to have a utility method to detect "special" variables? I mean this tokens[0].charAt(0) == '$' || tokens[0].startsWith("...$"), we repeat it several times here.
|
@tmysik thanks. I added a commit that consolidates the tests into a single method. I think it improves readability. |
| ArrayList<String> types = new ArrayList<>(); | ||
| if (tokens.length > 0 && (isReturnTag(tagType) | ||
| || !(tokens[0].startsWith("$") /* variable */ || tokens[0].startsWith("...$") /* variadic variable */ ))) { //NOI18N | ||
| if (tokens.length > 0 && (isReturnTag(tagType) || !isVariableName(tokens[0]))) { //NOI18N |
There was a problem hiding this comment.
Nitpick: //NOI18N can be removed.
| return variable; | ||
| } | ||
|
|
||
| public static boolean isVariableName(String token) { |
There was a problem hiding this comment.
Nitpick: do we need //NOI18N to be used in this method?
|
@matthiasblaesing looks better to me now, thank you! |
Variadic variables (...$variable) were not correctly parsed by the PHPDoc parser. The issue manifests like this: - variadic variables in PHPDoc are not highlighted by usage marker - renaming does not work for variadic marked variables Closes: apache#9437
01dd57b to
8ea4484
Compare
|
Fixed the wrongly placed and missing NOI18N comments, squashed and will merge tomorrow. |
|
@tmysik @junichi11 thanks for reviews! |
Variadic variables (...$variable) were not correctly parsed by the PHPDoc parser. The issue manifests like this:
Closes: #9437