Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117512 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90179 invoked from network); 11 Apr 2022 12:13:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Apr 2022 12:13:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1D5031804CF for ; Mon, 11 Apr 2022 06:45:28 -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.7 required=5.0 tests=BAYES_05,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, T_SCC_BODY_TEXT_LINE 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-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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, 11 Apr 2022 06:45:27 -0700 (PDT) Received: by mail-yb1-f178.google.com with SMTP id g30so686255ybe.4 for ; Mon, 11 Apr 2022 06:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E/P1XoPZvrMfp9R7IQqilJayk+fpiG38cX6uwzVY1B8=; b=Nrf1m++ex1Vjb68u9HMWeNHXJ3+pPnIA3Qs8fgg2z9xS2QG9qqkelf+zmxnZHog94u T66WjEIxV08chhm5YfuMxh9l5kgrCX0oFy3NZKAR6w4slG2doAMX2dg/DajTNjC53CI+ msjPY4RFOuDybfMHAAm6l1Go0ye/1QMAEIWlCe2ElWP+MoOWjJQqq1LJfVVJn0e2y9No orPt/x1maJyCc5dA71F0YPxNBfe7Z8adatDQCwLQwYt8eLOLlA6P43Ucfij+yJhT6hlH EadLeAjAwb0ExJz5pNQeBPAcw1hGh3IZYTGY2rUx5djiRAbT0SqFqZdkzci6mn9QGE0Z KApQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E/P1XoPZvrMfp9R7IQqilJayk+fpiG38cX6uwzVY1B8=; b=HWKzBrK4rKP6U8PgkNMpyaI0GU6NKp/f4Uv9UJ5G3ADc5m9hoNglBU4PFdWwHKCfWS BZ6rfvlNiHcJzdrAL+UTEYdts0wyGvso2yiWBF9C+qY4I4SdMj3OEB2Xo7+m0sUPaYWo S6Yo+H82JvN/kZSKHydxtnEN4Sh9FKoSdSBPVSbH8ixIpScb77TU8+srQ6IpDeAcYT4Y JDSy2k/Hh96+Y0Qy8qoJzPhUyEpZSJDaivbTGdNSm55cQPfN6cAv6OrF7TCK70DrNs4L kkuklvOrv2HlSt44shCMXACyBHwYY6PytSNLPyfI0o3XoOqQiTPgmWxtST/dRB7VrB3O casA== X-Gm-Message-State: AOAM533Oa44r4YKVf05U/TMiHT2huOlBcWiS6ydWEzMfuCUEucwrfhac +hcubAiHlAVcvdBpAc6OB4ZyiyEaOsMgfUC1iA== X-Google-Smtp-Source: ABdhPJybCMn1jU7hi6HhA0qI9Ly224hb3xcv142bvCrCELzo+hzulzO/sDFhFTvSpfoDKGGV4VMAVd4IH/nmjG3y4zQ= X-Received: by 2002:a05:6902:1026:b0:63d:cb9f:6e03 with SMTP id x6-20020a056902102600b0063dcb9f6e03mr22708128ybt.9.1649684726902; Mon, 11 Apr 2022 06:45:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 11 Apr 2022 15:45:15 +0200 Message-ID: To: "G. P. B." Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000002374ea05dc6128c2" Subject: Re: [PHP-DEV] [RFC] Add true as type From: guilliam.xavier@gmail.com (Guilliam Xavier) --0000000000002374ea05dc6128c2 Content-Type: text/plain; charset="UTF-8" Hi, On Mon, Apr 11, 2022 at 3:33 PM G. P. B. wrote: > > There are many many many more internal functions in PHP which only return > true, but only since PHP 8.0.0, and this is due to the huge amount of > E_WARNING to ValueError/TypeError promotion which has happened. > These functions previously did return false in certain circumstances, and > although I agree that changing these to void *would* be the most ideal, > being able to do this communicating that these functions only return true > (which means one can ignore the return value) is the first step. > Moreover, it is even more of a BC break compared to changing something > which only returns false to void as code like: > if (always_true(...)){ ... } > would stop executing this code path. > > Not adding true as a type prevents extending methods which return bool to > always return true to clearly document this within the typesystem. > Then you should probably update the RFC to say that, and better examples ;) Maybe also add an example of "refinement" during inheritance (from `: bool` to `: true`)? One more thing: maybe the part about `true|false` being an error (use `bool`) should be its own subsection, as that's not exactly "redundancy", and differs from `array|\Traversable` being interchangeable with `iterable`. Regards, -- Guilliam Xavier --0000000000002374ea05dc6128c2--