On Mon, Jul 12, 2021 at 10:20 PM Mike Schinkel <m...@newclarity.net> wrote:
> It seems you have just illustrated why in reality we really do not need > type casting/assertions in PHP given its current features, because we > already have what we need. > That's not an argument I agree with, as it would invalidate the need for short closures, null coalesce, constructor property promotion, etc. Continuing on the previous example: ```php $service = $container->get(SomeService::class); assert($service instanceof SomeService); // could be replaced with $container->get<SomeService>(); // or in case of multiple instances: $container->get<SomeService>('the.service.alias'); // perhaps the service is optional $container->get<?SomeService>(); ```