atom-autocomplete-php
atom-autocomplete-php copied to clipboard
Function ReflectionType::__toString() is deprecated
Whenever I open a php file I get this error:
Failed to get methods for App\HomeController.php
Function ReflectionType::__toString() is deprecated
I think this line is making this error:
https://github.com/Peekmo/atom-autocomplete-php/blob/master/php/services/Tools.php
$result['return']['type'] = method_exists($function, 'getReturnType') && $function->hasReturnType() // PHP7
? $function->getReturnType()->__toString()
: $result['return']['type']
;
I think it should be replaced with:
https://github.com/event-engine/php-data/pull/2/commits/e8daa9e1f6673238d18b626526acde96fca097fb
$returnType = $method->getReturnType();
$type = $returnType->getName();
Final result should be:
$result['return']['type'] = method_exists($function, 'getReturnType') && $function->hasReturnType() // PHP7
? $function->getReturnType()->getName()
: $result['return']['type']
;
I haven't tested if it but I made some first changes for testing purposes:
https://github.com/orukaz/atom-autocomplete-php/blob/master/php/services/Tools.php
Hi friend! Did you test it? How can I check if that works? Good job!
I've tried it and it works! Just put this line as you said and voila !:
? $function->getReturnType()->getName()