Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

ErrorException : Function ReflectionType::__toString() is deprecated #15

Closed
DanielLavoie90 opened this issue Mar 19, 2020 · 8 comments
Closed

Comments

@DanielLavoie90
Copy link

class ReflectionType
{
	/**
	 * To string
	 * @link https://php.net/manual/en/reflectiontype.tostring.php
	 * @return string Returns the type of the parameter.
	 * @since 7.0
	 * @deprecated 7.1 Please use getName()
	 * @see \ReflectionType::getName()
	 */
	public function __toString()
	{
	}
}

Adding getName() after getType() on line 178 of MacrosCommand seems to fix the problem.

$this->write($parameter->getType()->getName() . " ");

@KristofMorva KristofMorva self-assigned this Mar 19, 2020
@KristofMorva
Copy link
Owner

Hey, did you happen to investigate which PHP version GetType's GetName is available from? Just to make sure that the change does not break older PHP versions :)

@Teakowa
Copy link
Contributor

Teakowa commented Apr 4, 2020

getName only support PHP>=7.1.0 ReflectionNamedType::getName

@KristofMorva
Copy link
Owner

Thank you for letting me know.
Let's fix this warning in a next major version to make sure that it does not affect people with older PHP versions.

Does any of you have the time for a PR & testing it out if it works the same, properly? Sorry for not being able to do it myself, but I don't have a web development environment right now :)

@Teakowa
Copy link
Contributor

Teakowa commented Apr 5, 2020

ReflectionParameter::getType is a new feature in PHP 7.0, and the in the package makes it impossible to use this package for versions < PHP 7.0.

So, it seems that from the beginning this package was not supported < Laravel version 5.5? xD

@KristofMorva
Copy link
Owner

KristofMorva commented Apr 5, 2020

Hmm, if I remember right I wrote and used this package with Laravel 5.4.

@Teakowa
Copy link
Contributor

Teakowa commented Apr 6, 2020

Perhaps your Laravel 5.4 is running on PHP 7?

Because I'm running Laravel 5.4 with PHP 5.6 get an error.

image

PHP Fatal error:  Call to undefined method ReflectionFunction::getReturnType() in /var/www/5.4/vendor/tutorigo/laravel-ide-macros/src/Console/MacrosCommand.php on line 110

In MacrosCommand.php line 110:

  Call to undefined method ReflectionFunction::getReturnType()

ReflectionFunction::getReturnType only support PHP 7 too. xD

@KristofMorva
Copy link
Owner

Hmmm alright, thanks for checking it out, then it should be safe to require PHP 7.0 in the next patch version, and integrate a PR for this issue with PHP 7.1 requirement in a new major version.

@KristofMorva
Copy link
Owner

#19 should solve it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants