<?php
trait NoEsNada
{
public function nothing()
{
echo 'hola';
}
}
class Pablo
{
use NoEsNada;
}
function nada(NoEsNada $x) {
$x->nothing();
}
$pablo = new Pablo();
nada($pablo);
Fatal error: Uncaught TypeError: nada(): Argument #1 ($x) must be of type NoEsNada, Pablo given, called in /in/DU1DG on line 25 and defined in /in/DU1DG:17
Stack trace:
#0 /in/DU1DG(25): nada(Object(Pablo))
#1 {main}
thrown in /in/DU1DG on line 17
Process exited with code 255.
Fatal error: Uncaught TypeError: Argument 1 passed to nada() must be an instance of NoEsNada, instance of Pablo given, called in /in/DU1DG on line 25 and defined in /in/DU1DG:17
Stack trace:
#0 /in/DU1DG(25): nada(Object(Pablo))
#1 {main}
thrown in /in/DU1DG on line 17
Process exited with code 255.
Catchable fatal error: Argument 1 passed to nada() must be an instance of NoEsNada, instance of Pablo given, called in /in/DU1DG on line 25 and defined in /in/DU1DG on line 17
Process exited with code 255.