<?php
namespace Toto;
class Test
{
public static function testStatic()
{
return $this;
}
public function newInstance()
{
return $this::testStatic();
}
}
var_dump((new Test())->newInstance());
Fatal error: Uncaught Error: Using $this when not in object context in /in/PlSIE:9
Stack trace:
#0 /in/PlSIE(14): Toto\Test::testStatic()
#1 /in/PlSIE(18): Toto\Test->newInstance()
#2 {main}
thrown in /in/PlSIE on line 9
Process exited with code 255.