docs: Fix Doxygen parsing of @var descriptions with $var names
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 5 Sep 2019 18:21:59 +0000 (19:21 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 5 Sep 2019 18:24:14 +0000 (19:24 +0100)
commitb31b3519e9657ebbb3d060fef29d140f3b54e288
tree2280e391cae43ad0dd59a7fb0443a4ec06ae4fef
parent56fdc4715eba743feb6f3228553b255bdee466d7
docs: Fix Doxygen parsing of @var descriptions with $var names

It was wrongly assuming that if the description started with
a dollar sign, that that first word would be the variable name
it was documenting, thus leading to some oddly documented
class members, such as from:

 > SimpleCallbacks.php:
 > /** @var (string|string[])[] $_GET/$_POST data */

Fix this by capturing the first word and actually comparing
it to the variable name we're about to document.

Keep the overall behaviour the same as before, that is,
if the description does indeed start with the correct variable
name, then don't modify it in any way (already covered by test).

Change-Id: I48ed20cf75f146a30d5976fcad3a72d5a9a4906b
maintenance/includes/MWDoxygenFilter.php
tests/phpunit/maintenance/MWDoxygenFilterTest.php