Reputation: 16837
so given
class Foo {
}
interface TypeProvider() {
type(): ? ;
}
class Bar implements TypeProvider {
type(): ? {
return (Foo);
}
}
class Baz implements TypeProvider {
type(): ? {
return (Bar);
}
}
Foo
is a class but if I'm returning a class from a method, what type do I assign the method signature?
as an aside is return (Foo)
and return Foo
the same thing? if they're different I'm not certain I don't want the latter.
Upvotes: 1
Views: 33
Reputation: 164139
It should be the Foo
constructor:
class Bar {
type(): { new(): Foo } {
return (Foo);
}
}
Or:
interface FooConstructor {
new(): Foo;
}
class Bar {
type(): FooConstructor {
return (Foo);
}
}
Upvotes: 2