Re: [PHP-DEV] Type casting syntax

This is only part of a thread. view whole thread
July 12, 2021 21:16 (Lynn)
On Mon, Jul 12, 2021 at 10:36 PM Mike Schinkel <> wrote:

> > In your hypothetical view here, what happens when the $container does not > have SomeService to provide? Does it throw an Exception? > > Up to the developer that implements it. If the signature would be
`get(?string $id): T;` then I would assume an error should be thrown by PHP, or an Exception by the method, or handled by the developer to always return `T`. `?SomeException` as `T` could let the developer not throw an exception if needed and return `null` instead.