Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115692 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46967 invoked from network); 11 Aug 2021 10:15:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2021 10:15:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A063F1804BD for ; Wed, 11 Aug 2021 03:45:43 -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=-0.2 required=5.0 tests=BAYES_20,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 ; Wed, 11 Aug 2021 03:45:43 -0700 (PDT) Received: by mail-ed1-f53.google.com with SMTP id bo19so3005745edb.9 for ; Wed, 11 Aug 2021 03:45:43 -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; bh=hR4IlTTIAj9/+1oYnlhrallrcIO3qUUqZryk7pjVhVg=; b=Ec5kSxyPPv9Q8LuGqyXhPJgwYExJ49EiyhMnqazG+DUvOB8kC7FGxq1aCNLr5uQTWL Ggs1RRtFZjbleGpSVSkMz6paFWmwWN0gBlOcD4dcaUk+0zyEnOStjNcQoCI8TSaGEp4Z eKOfLbWtRsZkc7RuEfm0tGPXD/1dGCGFa9zGlG0l0aT/EN64br5Vko68Uwx2oOrGVTuk OYrGBK0rwzff7sJASgk74q+Tl/EJVh81WMahApXxD7KS3Ws0EfnzTy7sk7G05gdXWtmU bWJk51mN3bTralPljOk/8luGzZHlmlCGH+CqpfqIgPt1foqLQi7yAZsbYeJco6HzfLZj JI6w== 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; bh=hR4IlTTIAj9/+1oYnlhrallrcIO3qUUqZryk7pjVhVg=; b=RBbN4dSs1qR0MitOR7lD44KaJVhrFfYnXoPKRz3D0zNqnnhRZesPkqCeNVavBita/T YXmiZlSNH6o4dfzE4OzohqplSrE2/EJcq/oB+X9+Szup2BmNUnivP4ts19C0bnecrQBZ Df9A7pYktKrnmjdK+BO9uB+kwcOsNh9glJfdHALUAM+m5pnkqjZnRXHdupOOXy2oKg2d C9zH2O7Q/MHZb8POctxe+9dq0MmenZ5wZtc9SuD0yjlb09DTfcWnHbeth57CSmUDi4yA HqJqGevzZ4d0J4LKEn6JONdsRdyMCnlTA6t3Hl8oolNXnQQKv8aM/ffQoZmF7JHqCesz ujVg== X-Gm-Message-State: AOAM533IuPP2/+Fy6kmC7KS1/6GeKKuRI6fXYWUgBOSMgJ/ha9sZIi91 6R3BhM+7j6W/wWbMfSQG8g6g9GdAE/PSd3ZqPyTVZFlnLIvptA== X-Google-Smtp-Source: ABdhPJyhxqNy1AXyI8SQi8To9Y5m+pt7KoWf/KgSEdeFheHyKrCG+jL6ilxbtBAB1QQP5aE0JFOvpUYEXWzTovUwAtY= X-Received: by 2002:aa7:cc83:: with SMTP id p3mr10649057edt.365.1628678739984; Wed, 11 Aug 2021 03:45:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 11 Aug 2021 12:45:28 +0200 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000c003fb05c9465178" Subject: Re: [RFC] Nullable intersection types From: nicolas.grekas@gmail.com (Nicolas Grekas) --000000000000c003fb05c9465178 Content-Type: text/plain; charset="UTF-8" > Hi everyone, > > as proposed by Nikita and Joe, I'm submitting this late RFC for your > consideration for inclusion in PHP 8.1. Intersection types as currently > accepted are not nullable. This RFC proposes to make them so. > > I wrote everything down about the reasons why here: > https://wiki.php.net/rfc/nullable_intersection_types > > Please have a look and let me know what you think. > > Have a nice read, > > Nicolas > For the record, I was suggested to add a few more words about reflection in the RFC. In "Proposal", I added this: > On the reflection side, ''ReflectionIntersectionType::allowsNull()'' will return ''true''/''false'' depending on what the intersection type accepts. In "Rationale", I added this: > About reflection, one could imagine a more complex model based on a ''ReflectionIntersectionType'' nested inside a ''ReflectionUnionType''. This RFC proposes to rely on ''ReflectionIntersectionType::allowsNull()'' instead. This is consistent with how ''T|null'' is returned without ''ReflectionUnionType'' wrapper, and is also simpler for userland to deal with. --000000000000c003fb05c9465178--