TestOverwritePropClass example

public function testFinalPublicClass()
    {
        $proxy = $this->createLazyProxy(FinalPublicClass::classfn () => new FinalPublicClass());

        $this->assertSame(1, $proxy->increment());
        $this->assertSame(2, $proxy->increment());
        $this->assertSame(1, $proxy->decrement());
    }

    public function testOverwritePropClass()
    {
        $proxy = $this->createLazyProxy(TestOverwritePropClass::classfn () => new TestOverwritePropClass('123', 5));

        $this->assertSame('123', $proxy->getDep());
        $this->assertSame(1, $proxy->increment());
    }

    public function testWither()
    {
        $obj = new class() {
            public $foo = 123;

            public function withFoo($foo)static
            {
Home | Imprint | This part of the site doesn't use cookies.