<?php
trait Foo {
public function foo() {
var_dump(method_exists($this, 'bar'));
}
}
class Bar {
use Foo;
public function bar() {}
}
$bar = new Bar(); $bar->foo();
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in /in/vJno5 on line 10
bool(true)