- var_dump: documentation ( source)
<?php
declare(strict_types=1);
class Foo {
private $x;
public function setX($x)
{
$this->x = $x;
}
public function getX()
{
return $this->x;
}
}
function test() : Foo
{
return new Foo;
}
$x = test()->setX('test');
var_dump($x->getX());