Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117581 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20014 invoked from network); 23 Apr 2022 16:50:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2022 16:50:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3F7DF1804C5 for ; Sat, 23 Apr 2022 11:25:26 -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-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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:25:25 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id f38so20108059ybi.3 for ; Sat, 23 Apr 2022 11:25:25 -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=/AldGuPefVkULi4qQDPW/+OhD6dh4GX2sYV7uTIenRY=; b=Id7Ts/lJQfiOCcsY8LZDa13R4ufweCJjK/UHRTdIAuki3dOfq5QkEaOGXFRF4/6TMP 0ZIQTZEc1b/WUnKGqb/NHr9g85/vGYzMchBC8WxUGHIFozB768XU5eylqkHvIzPpmk+1 GF1UM9WM+AQZuYaHhP/0os3c3J8Bec1mCpV4BT6s7DTMddJt4olEoHOrAe58UPcpjtkS DvOpyDngeiRmqYU8accxsyFUcXXYq60G+nG5Zn1iiW4f5OelZVspWbfvyZSkAS/27MeM QGesMWALOP4jnKlF4HX0ANLlAthvVg1gnxNpwqNc4V6Ih7qLoO206DmztRJvFprqJ3us JnFQ== 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=/AldGuPefVkULi4qQDPW/+OhD6dh4GX2sYV7uTIenRY=; b=QlDqJQB54YXD9IP3FzhWihctG/2SPM1fQnejwyEFDeJu4JWA5I2vo2jIVzIWJ+bCDq cf9UG0Z0tTl6/Ajq93rZhR2nqr4IrcvYZLr76Md0bskJM4SXkxzQouTo9iGIzpR+6nkd 0h9Q/9VDP+/CghGCUgg7jXy2euSHoZTWgekZCjnwMavU33zdfEGvlk8HIYUeYGppf3Sf zuDA5naBuugA9EhYZv4NN7bDP3smWdvZd9ayKe9hANGRXffZI57fDoISZFvdd7ruDVy4 M0OA7YXjESJiyLCNgJg8sI/T+8evvXYpg3CrWc3kdcF5ZcAfFIFEQGJVfv2UxX1Bp7oS RV9Q== X-Gm-Message-State: AOAM5312ACgEMfpuSVx10G4Ffjccne1U8f4SqdoxT9EkLGeXpoQUwPVV r2lxxS6hghUaoIUmsPnDhiX5OQk564vlUFFEZS8mjJu0Hp0= X-Google-Smtp-Source: ABdhPJwqZtdHZtmm5Jtnho5lra4QvCBnkjoNImUuUtuar86sNV1PSpyxoNoReXjUv6st9RXqCQ0iqe/OteFFHQhEtaI= X-Received: by 2002:a25:8206:0:b0:645:88b5:e464 with SMTP id q6-20020a258206000000b0064588b5e464mr8381526ybk.341.1650738325383; Sat, 23 Apr 2022 11:25:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 23 Apr 2022 19:25:14 +0100 Message-ID: To: Marco Pivetta Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000806dad05dd56770b" Subject: Re: [PHP-DEV] Canonicalize "iterable" into "array|Traversable" and Reflection From: george.banyard@gmail.com ("G. P. B.") --000000000000806dad05dd56770b Content-Type: text/plain; charset="UTF-8" On Sat, 23 Apr 2022 at 19:19, Marco Pivetta wrote: > 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? > They would, that's the main point of this change is to make handling this sort of code easier. As currently we need to manually check that array is indeed compatible with iterable and similarly with Traversable. With this change, the engine would effectively see: interface A { function foo(array|\Traversable $param): array|\Traversable; } interface B { function foo(array|\Trabersable $param): array|\Traversable: } Allowing us to use the generic LSP handling (and in this case it is trivial) --000000000000806dad05dd56770b--