-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fix FQN class, method, property and constant linking #185
Conversation
2991519
to
80c2cd3
Compare
Added a method for normalizing the FQNs. As it was trivial, the same fix was applied to constants and properties. |
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.
This is already merged, I know. Only to comment what can make te code easier in future.
@@ -1811,7 +1811,7 @@ private function convertConstantNameToId(string $constantName): string { | |||
$tempLinkValue = str_replace( |
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.
In a future version, move all transformations inside the normalize function (trim, replace), to make understanding the code easier.
@@ -1855,7 +1855,7 @@ public function format_property_text($value, $tag) { | |||
$tempLinkValue = str_replace( |
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.
The replace list here differs from other point. Maybe there is necessary two normalize functions, or if the difference is accidental, to test what list of substitutions is the correct.
@@ -666,7 +666,7 @@ public function format_type_methodparam_text($type, $tagname) { | |||
} | |||
|
|||
public function format_type_text($type, $tagname) { | |||
$t = strtr(strtolower($type), ["_" => "-", "\\" => "-"]); |
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.
Note how these substations lists are copied everywhere.
@@ -880,7 +880,7 @@ public function format_classsynopsis_oo_name_text($value, $tag) { | |||
} | |||
|
|||
public function format_classname_text($value, $tag) { | |||
if (($filename = $this->getClassnameLink(strtolower($value))) !== null && $this->cchunk["class_name_ref"] !== strtolower($value)) { | |||
if (($filename = $this->getClassnameLink($this->normalizeFQN($value))) !== null && $this->cchunk["class_name_ref"] !== strtolower($value)) { |
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.
This is somewhat unrelated, but in a future version, first test if getClassnameLink()
with fails with raw string, and then test again with plain \trim()
. In this case, generate the link as usual but generate an warning, as this a source error (unexpected whitespace around type/constante/etc tags).
Minimal fix for FQN class and method/function linking not working. Closes GH-170.