Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115419 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53428 invoked from network); 12 Jul 2021 20:53:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jul 2021 20:53:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2D4F7180502 for ; Mon, 12 Jul 2021 14:16:47 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 12 Jul 2021 14:16:46 -0700 (PDT) Received: by mail-il1-f174.google.com with SMTP id a11so21071507ilf.2 for ; Mon, 12 Jul 2021 14:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WHjVQ/B3PxjB/5nsiXqHR54cmlx9+ntMN6rwbFhmu8Q=; b=djI39a1BpsrLJjmcg/1T0VAPuAVJslpblnsMr5agL6Oi1bApnI9QMHQEtC+zKrEnFl ReaoP+jIiyZib/94UzCeg/0aXYwgRwJwTc9puil51B8ZtrBEYzmMaW8ZgsZziJ6jUoP+ Wph5EGhDotrvDw3HjoJViHdvkcjlfuL4zjiiKv2YjWQbk8Q7fJ7lsbfy7Mh/rY2Rb+W7 CUvj3FohE21cJPeS8SwCIJ5OSPEfMiRmTcSUksJ3EhXkgacBJFw/DejjveZkYkgDEST9 8gMZc6Mj/buFjO1oFQUSjoBtxxa6glQeej3gzP3rbx8sGeKcDk6Y5Sfp/rQUuBk8ByU5 d4EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WHjVQ/B3PxjB/5nsiXqHR54cmlx9+ntMN6rwbFhmu8Q=; b=c3Wo7VMq5n6sViCuanCNyuKCabbYeFI1EgjrF1NdezhL2m/LO4CMGMkmwWsqdQpv6j 7E7yQ7mggMPWP9zR9GMUWkXhR+eAw1C9GodWfyH3144PRIcR0o5o5+RLkwn0eQzOrLg1 93vG16pe3ZltOjc1tsaOZy7NP2Cyt0EFqotYKx34klrUC0xXWOKTyqP7GOlvnRuWpQ5F HSIYqz2VcHE/SCdAQg5pAQsUcqeaFT0k1hRQz+FqDr1+6jq9XlUCcqNiXtAW6huhLEDG h3gekZmforHLydYkkORPNjGYYUkibI+ki2lZDDefJbFENjldu7kMKq0cG6bnENvaTGl6 499g== X-Gm-Message-State: AOAM532Hgqc8Z3gwgcppB6lcx2mr218vjMUnylbC+HD7mV4cFmzf0g6n kuY5WHHEfz/BMG3TOI6KOMJW25qNDN+Vxi35ukk= X-Google-Smtp-Source: ABdhPJxWoE5B9W44cXKZ5pwJBn/ndokqAJW5lywy5RpMVxnNG/hl4yLAxKLVOQ+9veSRxBQnPUU9R7bQWs8mdJIJ+Tg= X-Received: by 2002:a92:d5cf:: with SMTP id d15mr562373ilq.194.1626124604444; Mon, 12 Jul 2021 14:16:44 -0700 (PDT) MIME-Version: 1.0 References: <0d28ee72-accd-4dfc-a8e0-018c99e4a86d@www.fastmail.com> <90547b22-1b12-4cdb-acf5-bde6cace8aad@www.fastmail.com> <351E0836-93B1-4021-9754-2681C6E7BA34@newclarity.net> In-Reply-To: Date: Mon, 12 Jul 2021 23:16:18 +0200 Message-ID: To: Mike Schinkel Cc: Max Semenik , php internals Content-Type: multipart/alternative; boundary="00000000000068970b05c6f3a340" Subject: Re: [PHP-DEV] Type casting syntax From: kjarli@gmail.com (Lynn) --00000000000068970b05c6f3a340 Content-Type: text/plain; charset="UTF-8" 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. --00000000000068970b05c6f3a340--