1<?php
2function foo() {
3    return new class extends Bar {};
4}
5function bar() {
6    class Foo extends Bar {
7    }
8}
9