Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117580 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18403 invoked from network); 23 Apr 2022 16:44:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2022 16:44:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9FB111804A9 for ; Sat, 23 Apr 2022 11:19:13 -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-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 ; Sat, 23 Apr 2022 11:19:13 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id j2so20138790ybu.0 for ; Sat, 23 Apr 2022 11:19:13 -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=ZJL/u8RRefB4lN0jbyZbXZ8ce3X4JnShtcsKZNWSTUo=; b=lfCWFjwNFjYgVe3qzWijpRH0VVcv6I0TNpauaxG6L3v+s0p1Xd2/6k92Hm2Ksqz3mF OmM/Pcmuq5VHJ6pm8yWb8XSENdAZYvT1hI9pYGtufKfYUV7cUWQf45mJlgTKpfpTw+ng jSiOtIAdCijraYeREGcfQaVcqNvQ1KputkVCyyu/sv7Z2ZixFzHBE2GYHbdH57+RCTGS l+JTa1nDp9MLlTChF0Mu04sgAo25n1D8hoWHa5A0qpHGIt0v/2AjkTGgTgKYPrhlMNAW YgBZaJcvftlFTBVRi9FaQ/VqcPI1XPm+9DILDsa4WlYicxTUWUs4mQnGqejakTEN99S4 CwUA== 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=ZJL/u8RRefB4lN0jbyZbXZ8ce3X4JnShtcsKZNWSTUo=; b=ziXjAD8pf50M1lmNKZze+4OUmdEdJFiFGU9oQ5eJIL1BF23HrBz/HRmXnTIrSN24Xf TrXrDhNc57xZpV63HF/KOFNQ9R0HWEBRsVzhwtoyuWQGgERu8AMNZE1ZeYZ2ACE9CtbF YuSwmz3cj+QKSzFDlh2LOOZSpKfXgdUROImn3+AVE9zm2fTQWkf5PbZaglQMiQlPSZ+J EJw17yzpVKHByGTnaXwXqjbBZGA5LpJn7C4l+40lDiQwbChpO1XGMHt1tNLF9agPtRwR riwU8UPix/0wkL7Q5UN2FEwchWxm8a79ofrxg4gMn/ourQ31WKZCWrNOkQhQFMpN5nfZ 2dYA== X-Gm-Message-State: AOAM531w35FwX89W9p2RRIIoPwZ1iFs5oa0cZ2rxiQWIps9alDQMnPrF wzTno1hyq8NTZXEvav7usUvGfl7Kk4LhDo2VonmTLTzsCpk= X-Google-Smtp-Source: ABdhPJyC0Mo6gf3IE9jwDqnCFuMtjmSrbwGiV1Mo9cDRMA8Mo3uAHB5oVJ3HKkYcaYwtJtvxBr8ZNfFOuQ/02P18Ucs= X-Received: by 2002:a25:d9cc:0:b0:645:1c:59ef with SMTP id q195-20020a25d9cc000000b00645001c59efmr9887591ybg.559.1650737953097; Sat, 23 Apr 2022 11:19:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 23 Apr 2022 20:19:00 +0200 Message-ID: To: "G. P. B." Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000004fccc305dd566168" Subject: Re: [PHP-DEV] Canonicalize "iterable" into "array|Traversable" and Reflection From: ocramius@gmail.com (Marco Pivetta) --0000000000004fccc305dd566168 Content-Type: text/plain; charset="UTF-8" Hey George, How would the engine behave (with this RFC included) with an inheritance check? Specifically: interface A { function foo(interable $param): iterable; } interface B { function foo(array|\Trabersable $param): array|\Traversable: } Would they be compatible with each other, if put in inheritance between each other in any order? On Sat, 23 Apr 2022, 14:28 G. P. B., wrote: > Hello internals, > > One area the engine currently needs to take special care is dealing with > the typing relation between iterable, Traversable, and array. > The change is to canonicalize "iterable" into "array|Traversable" as this > then removes this special case. > > However, doing so breaks Reflection for iterable types and will now return > a ReflectionUnionType instead of a ReflectionNamed type. > There are a couple of options to proceed: > - Accept the BC break, and expect end users to already be handling union > types for code running on 8.2 (least complexity) > - Only provide a BC layer for (?)iterable to return a ReflectionNamedType > and have usages of iterable in a union type be exposed as Traversable|array > (OK complexity) > - Full BC such that even in union types where iterabl was used > Traversable|array gets converted back to iterable (high complexity) > > The PR for this change is https://github.com/php/php-src/pull/7309 > > This PR is also blocking the implementation for DNF types, as it vastly > simplifies the implementation of it. > > Best regards, > > George P. Banyard > --0000000000004fccc305dd566168--