- var_dump: documentation ( source)
<?php
class Foo {
use TFoo;
function test() {
var_dump(__METHOD__);
$this->getFromTrait();
}
}
class Bar {
public function __construct($a) {
}
function some() {
die(__METHOD__);
}
}
trait TFoo {
function getFromTrait() {
return new Bar($this->getSomething());
}
function getSomething() {
// Must be called!!!
die(__METHOD__);
}
}
(new Foo())->test();