vendredi 19 février 2021

How replace ReflectionParameter::getClass() in php8

In php8 ReflectionParameter::getType() replace getClass().

documentation

First i would like to know what is the difference between $parameter->getClass()->getName() and $parameter->getClass() ?

Then this two lines for ReflectionParameter $param:

$param->getClass()->getName()
$param->getClass()

In php 8 they are replaced identically by :

$param->getType() && !$param->getType()->isBuiltin() 
? new ReflectionClass($param->getType()->getName())
: null;

or have any difference ? Can you explain to me I am not understood thank you :)





Aucun commentaire:

Enregistrer un commentaire