How can we tell if a class uses a Trait?
For example:
trait Setter
{
protected $vars = [];
public function __set($key, $value)
{
$this->vars[$key] = $value;
}
}
class User
{
use Setter;
}
$user = new User;
if ($user contém o trait Setter) {
// faça alguma coisa
}
According to the given code, how do you know that $user
is using trait
Setter
?