Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118759 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 63917 invoked from network); 5 Oct 2022 18:16:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Oct 2022 18:16:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4DBA9180505 for ; Wed, 5 Oct 2022 11:16:08 -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, 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-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 5 Oct 2022 11:16:07 -0700 (PDT) Received: by mail-ej1-f48.google.com with SMTP id bj12so37184978ejb.13 for ; Wed, 05 Oct 2022 11:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date; bh=5WhMYKFFdfv2e4vzYAejiPvhZGtshYfSlzujq2U3CKk=; b=ptITZ4fU1Pd2uDkcfLQp0HQ4BRiaiA7a8lPjU0Dsm9pkpI/uARjJhYh8/5nNprvPjL f46oU7UmQzMzJhXf3DSsh7a3+XPY3gCZaY9V1YeAUhnt65w33rGErtB00pIs3asxHtDK 9phskZZ4eQRqnIl4TiT+U1wSZJGJLn+0bPJrmIsPXB5Ea0NK0eqBmKtToBmLdFLUAVqS O+oWM+AR3AEl8cDgGdS2zf/gWgdS1oaOSM1OeRsVYQ5RukvR845lcTAjkakPWvxeyn56 EU3hX29ooEbNKgjwjWffgOF0tZerS+BP6xz7HqOrYrCECgi2l+W+bObeJ8cURhYPiIr+ 27VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date; bh=5WhMYKFFdfv2e4vzYAejiPvhZGtshYfSlzujq2U3CKk=; b=j/hVYE6hJaJEqxUFO/ARGC0hPKX/IVESxHxLENVEQpjUl9SNe5f+1MYlcwEmFn4m5z Mt1n0h9BUaQo2ZNKG+p899eK55hj9+wDOKIoBJsWBqX6NqHvGoSrG66SrSvNb8NmU7BP a1E6h9rLg0nb37z4fUZzKMMck9a0HpihrZDhyIuY3sMOHBya5aa5Jr1EpmC+w4AgHKfr +ALBnxkqeBRTRtEDl1qggnxwlCbKY9ER5PG+9pLTEy9zpzotf20QXW9QZ01IZl3o3edJ VTR3o/+hYlsX73mONBMZlDbkjTNKqv9M3/SP7dilW/zjhofH/dn9KmBBrCRWg0+tEHxu Bxsg== X-Gm-Message-State: ACrzQf0DHxvNDsda7No8NXhnCI1i2LmFp05UFaEa9z3Fddr36J3NyAcj bHDAkoZEzU4uwFvP4VsfutU= X-Google-Smtp-Source: AMsMyM7weZ5PSnwChX6O4o55V0NLRRDQQAP/E9uaW3yW0073JNBDuT8HogiW3upuvQTfRqWriGAKQw== X-Received: by 2002:a17:907:6d9f:b0:789:dcd4:2f7a with SMTP id sb31-20020a1709076d9f00b00789dcd42f7amr728050ejc.130.1664993766374; Wed, 05 Oct 2022 11:16:06 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a8-20020a50e708000000b00458cc5f802asm4258545edn.73.2022.10.05.11.16.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 11:16:05 -0700 (PDT) Message-ID: <32751E00-9C1D-41A7-B87B-9D5FAAB84250@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_3FCCD607-EA44-4162-975A-B1ED444A709B" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Wed, 5 Oct 2022 20:16:05 +0200 In-Reply-To: Cc: juan carlos morales , PHP Internals To: Eugene Sidelnyk References: X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [PHP-DEV] Union type casts From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_3FCCD607-EA44-4162-975A-B1ED444A709B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 5 oct. 2022 =C3=A0 19:53, Eugene Sidelnyk a = =C3=A9crit : >=20 > I used to have an awkward feeling when it was necessary to convert the = nullable integer into a nullable string. It would be kind of ternary = operator anyway. Either `$b =3D (null !=3D=3D $a) ? (string)$a : null;` = or `$b =3D (string)$a ?: null;`.=20 >=20 > A lot easier to read would it be if written this way: `$b =3D = (?string)$a;`. The intentions are clear when doing explicit type-cast. >=20 > Currently, I don't see any other situations when this feature may be = useful >=20 >=20 > Thank you=20 There has been some discussion and interest around nullable casting = (which, contrarily to union type casting, has only one possible and = obvious semantics), see https://wiki.php.net/rfc/nullable-casting = and the two discussion = threads linked in the bottom of the page. However, the RFC seems to be = inactive for now, =E2=80=94Claude= --Apple-Mail=_3FCCD607-EA44-4162-975A-B1ED444A709B--