class Foo
{
    protected string $bar;
    
    public function __set( string $name, mixed $value ): void
    {
        echo "from setter, prop name '{$name}'\n<br>";
    }
    public function __get( string $name ): null
    {
        echo "from getter, prop name '{$name}'\n<br>";
      
      return null;
    }
    public static function doo(): void
    {
        $foo = new Foo;
        $foo->bar = 'foobar';
        echo $foo->bar;
    }
}
// The getter/setter will be called
$foo = new Foo;
$foo->bar = 'asd';
echo $foo->bar;
// The getter/setter not called
Foo::doo();