Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118748 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20664 invoked from network); 5 Oct 2022 08:04:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Oct 2022 08:04:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6E9361804BC for ; Wed, 5 Oct 2022 01:04:19 -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-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 01:04:19 -0700 (PDT) Received: by mail-ed1-f43.google.com with SMTP id e18so21886180edj.3 for ; Wed, 05 Oct 2022 01:04:19 -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=XyEXDo5B9PurEHpYla9/I/KSEK8M5ExsUXbxBbA8nKc=; b=Cro1W8T6Famj+DEChL8ENcm8kso5yzCBWD4z8N0phKxEZBtrp6nCK6VIBI+F8k5CC4 QGQyU18YPzrJfMqXDen0TNL3fzKFe9/MYyw29LKjtfrk3XDbwuNgqlnqJ4u2V5BhHIOT GyycRT+CcOsWN8NA2ztvX6pUt+4JVtAJIAZuyny3nk3xjkE3A1E35F2ruROOGmILXNyS WeGQRCwwaNIyViK2WD91x3L2ppErX8O12aqPV5892kGHmHAwAzCXw3l70gqF9szx3ARL zVmbYZlmCopSints2s+T2S4lUaGdNMKe3SvzxoQ9DfFddMXh71LxhVy0nAJml47sEl1E TJWg== 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=XyEXDo5B9PurEHpYla9/I/KSEK8M5ExsUXbxBbA8nKc=; b=7021CF+AFJ6aYywASf4/XF3F78hNy48BBQiuvA5HoSDcBUu0KK+SGLOiWz+dDqt8fP eLK+B5C5JPCsQSzWqXjYRNJX2w59hYGyGydhK5Bsr1cqPpg7nSy3mVedeJgbZivS3khv AyHbCOqzMhqkCSU0JYkkwOBCGP8GJ3VXrBhIdoTSO/QpBR1jjtp/n2/Ecuw94ij82T+7 Q595m7IZXVOKUcvDDy2UI0oqAcmoeZZhriPwvZLyRNQGjLAC+A8CTjZBnh1qp3BU3aVG CoAW1FGiHYgKWMp2WUU7/622FwoZKh2M3MfJ+T9g97+h8PX9bJW+Im4Ho1yT5swIQZG2 IjJg== X-Gm-Message-State: ACrzQf0d1TFH6Obn7m6h0+D3SpQJvn4O8KvQ4Y1ecaJQXRArrIKhlsbP QIFdJnAKLPv1nyzV1nwSsd0= X-Google-Smtp-Source: AMsMyM5bSBi1lzRbVVjpSlO8lScj2DzrXJuaFoLWEGQyo0LfG3zJTo6GoBNYWNbHHM+zo4CORjwMzg== X-Received: by 2002:a05:6402:4307:b0:459:4c7b:e843 with SMTP id m7-20020a056402430700b004594c7be843mr7318775edc.153.1664957057735; Wed, 05 Oct 2022 01:04:17 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id bi6-20020a170906a24600b00782cd82db09sm8256407ejb.106.2022.10.05.01.04.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2022 01:04:16 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_830880BC-819B-4FDE-8029-8968EE41D605" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Date: Wed, 5 Oct 2022 10:04:15 +0200 In-Reply-To: Cc: 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=_830880BC-819B-4FDE-8029-8968EE41D605 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 5 oct. 2022 =C3=A0 06:46, Eugene Sidelnyk a = =C3=A9crit : >=20 > I assume the behavior should be the same as if we called the function > having respective parameter type-hint (with a remark that strict types = are > disabled): Hi, Function parameters are more restrictive than explicit cast in what it = accepts. In particular, the following inputs are rejected with a = TypeError when fed to a function that accepts an `int`: `"3 mices"`, = `null`, `[ ]`. Most notably, no type conversion is performed when the = input type is `null` or `array`, or when the target type is `array` or = `object`. For reference, the original conversion rules are here: = https://wiki.php.net/rfc/union_types_v2#coercive_typing_mode = (I = don=E2=80=99t know if there has been adjustments since then.) =E2=80=94Claude --Apple-Mail=_830880BC-819B-4FDE-8029-8968EE41D605--