public function testOnce() { // from js + docs $num = 0; $increment = __u::once(function () use(&$num) { return $num++; }); $increment(); $increment(); $this->assertEquals(1, $num); // extra $num = 0; $increment = __u(function () use(&$num) { return $num++; })->once(); $increment(); $increment(); $this->assertEquals(1, $num); }