Fix syntax of JSDoc annotations @param
/@returns
to enable type hinting in IDE
#20742
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Some functions are already somehow annotated via JSDoc. But the syntax especially for
type
does not follow JSDoc standards.This PR fixes the JSDoc syntax of already annotated functions. Thereby IDEs apply correct type hinting.
No actual changes on the JavaScript code itself.
For JSDoc see:
@param
@returns
@type
Applied changes:
Dev: fix JSDoc annotated
type
in@param
and@returns
All changes done via Regex replacements:
Find:
@return
Replace:
@returns
Find:
(@param|@returns) array($| )
Replace:
$1 {Array}$2
Find:
(@param|@returns) (.+\|)array($| )
Replace:
$1 {$2Array}$3
Find:
(@param|@returns) bool($| )
Replace:
$1 {boolean}$2
Find:
(@param|@returns) DOMElement($| )
Replace:
$1 {Element}$2
Find:
(@param|@returns) function($| )
Replace:
$1 {Function}$2
Find:
(@param|@returns) integer($| )
Replace:
$1 {int}$2
Find:
(@param|@returns) mixed($| )
Replace:
$1 {\*}$2
Find:
(@param|@returns) ((?:boolean|int|float|null|number|string|Array|Element|Function|Object)(?:\|(?:boolean|int|float|null|number|string|Array|Element|Function|Object))*)($| )
Replace:
$1 {$2}$3
Find:
@returns (Tracker(?:\[\])?)($| )
Replace:
@returns {$1}$2
Dev: fix JSDoc annotated
@param
and@return
statementsManually fix:
@param
used instead of@returns
Review