Closed nclundsten closed 7 years ago
Yeah, we don't have any PHP 7 support... too bad it fails ungracefully as well.
Those typehints could / should be used in every place where we use doclbock @return
s now.
Hi @nclundsten!
Sorry, I know it took me almost a half a year to find the time to sit down and actually do some work, but here it is nonetheless. It should work reasonably well for most cases (hooks into the same place where the docblock @return ...
s do).
Give it a spin and let me know if I've missed something.
Doesn't work for me.
My ctags --version
is:
Universal Ctags 0.0.0(b6031a8), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Nov 10 2017, 13:00:44
URL: https://ctags.io/
Optional compiled features: +wildcards, +regex, +multibyte, +option-directory, +xpath, +json, +interactive, +yaml
And I am generating the tags with ctags -R --fields=afikmsS
and this generates for example:
returnBar fixtures/GetClassName/return_typehinted_functions.php /^ public function returnBar($a, $b = 'foo') : Bar {$/;" f class:FooReturnBars access:public signature:($a, $b = 'foo')
so ctags seems to work.
Vim looks like this:
To give another example: When I define my interface like this:
/**
* Login to webservice and get the token
*
* @param string $username username
* @param string $password password
* @param string $webservice webservice to login
*
* @return bool true if login was successful
*/
public function login(string $username, string $password, string $webservice): bool;
it gives me the autocompletion login()
But when I remove the Typehint:
/**
* Login to webservice and get the token
*
* @param string $username username
* @param string $password password
* @param string $webservice webservice to login
*
* @return bool true if login was successful
*/
public function login(string $username, string $password, string $webservice);
It returns the completion login(string $username, string $password, string $webservice)
, so that I can see the parameters.
without return typehint
public function findMe($a, $b = 'foo') { }
result
with return typehint
public function findMe($a, $b = 'foo') : string { }
expected
actual result
Note: seems to work correctly when just doing: