Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108263 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81233 invoked from network); 27 Jan 2020 11:33:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2020 11:33:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B990180532 for ; Mon, 27 Jan 2020 01:43:12 -0800 (PST) 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,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-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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, 27 Jan 2020 01:43:11 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id y6so9947539lji.0 for ; Mon, 27 Jan 2020 01:43:11 -0800 (PST) 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=yRXka1HpMb4PhuKLpdEPXKQ4RJC2H8J/+bENghzaoCM=; b=hXThqYVRjVeYv33VzOAbZ51EPQiMX96r+ZEv4I42VTHhenuUL5vOkatQ/OcGzrym+D XUxZPn8N7BlvOM1+RQg8dmyt9Ew17Vl+7AOzWqThN8GhdwhludhMYfhOb4ltpDIqtLQg 1+DiROLFXJmn2f+S9PYCETKwRZd3pERDRo8FYFpBEn7E0qglBCXsJmMYQUAQbff7bp13 ddHow1H5QnpobkvquQFyyQSaXj30U22kQ1vdYaTq/uLrydk4DCKrnah9fyYqF8HTTTrz 1iad0c+BL21OvNjPT7e6M5rBBF6F3T+X3KhFBzEOCTvDCOIgy0+DJhexTpnCuVwWVdQi nmPA== 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=yRXka1HpMb4PhuKLpdEPXKQ4RJC2H8J/+bENghzaoCM=; b=B1JVUAf2+ofZ35MhjTz7nl5rwLO2mcZTVN0ONzpkrUqVc4cxRhHO88KuzIOn03r1BD 0Mtw6wWkPJwt+1hM402YL17kbJPdjfYgo1yBHaWIlVUZiT5BsadJCvHPLK+dewd1BUmF difO5HyJrcMj33eGzynsv9AjIwyRnXR2D7LFDmVhTX7XI2QxzpDYxgsdW5uJulrPEP1R mpzzpSp38C276RHqcBDPDLkB/8/noeyeXjPE82kecMZhzC+6d3o8/Tl6Vz0WiB1gg4zc KgQS+pozCVakBNes31mRQmk3urgqbvN8e/eTPHjHTEXVzdwCv7aiqgemfmTI7BokX418 ONdQ== X-Gm-Message-State: APjAAAXHxCYbfNQOOXOBZNmL75u/zfaFyAoK2E2dayq1L6E9rwHr/qmL s4g2nXvummaSo6uHIhTetw/JahloAZ9EYykZUnk= X-Google-Smtp-Source: APXvYqyqpyR05b94C2TSEuY8lspYPPMXckG1CzPD4Wapny8NroRuxdMOOAKWNuoebSD1mfMmjkVvurLRGGQ5PxAnEZE= X-Received: by 2002:a2e:b55c:: with SMTP id a28mr9624838ljn.260.1580118188420; Mon, 27 Jan 2020 01:43:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 27 Jan 2020 10:42:52 +0100 Message-ID: To: Benjamin Morel Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000052f150059d1bef87" Subject: Re: [PHP-DEV] Union types | true pseudo-type From: nikita.ppv@gmail.com (Nikita Popov) --00000000000052f150059d1bef87 Content-Type: text/plain; charset="UTF-8" On Mon, Jan 20, 2020 at 6:30 PM Benjamin Morel wrote: > Hi internals, > > I'd like to bring back the topic of supporting "true" as a type in PHP 8 > union types. > Now that the RFC has been > successfully voted, I'd like to revive the discussion about adding the > "true" pseudo-type in addition to "false". > > In addition to my Packagist survey > , I'd like to point out that I > just came across a native method in the SSH2 extension, that does use true > as a type: > > https://www.php.net/manual/en/function.ssh2-auth-none.php > > > Returns TRUE if the server does accept "none" as an authentication method, > > or an array of accepted authentication methods on failure. > > > > Of course, you could type-hint it array|bool, but the same could be said > for |false. > > Thoughts? > Generally I'm fine with also allowing the "true" type. We certainly have quite a few extension methods that return isolated true values for legacy reasons. However, before "true" is allowed, it is important to answer the two questions at the end of https://wiki.php.net/rfc/union_types_v2#literal_types. Namely, how do true/false interact with weak typing coercions (currently "false" only accepts "false", but not 0 or "") and whether true|false should be equivalent to bool (also related to the previous question). Regards, Nikita --00000000000052f150059d1bef87--