Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118942 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90259 invoked from network); 2 Nov 2022 18:54:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Nov 2022 18:54:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A7C1C1804B0 for ; Wed, 2 Nov 2022 11:54:21 -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=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL, STOX_BOUND_090909_B,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS36483 23.83.216.0/22 X-Spam-Virus: No X-Envelope-From: Received: from weasel.tulip.relay.mailchannels.net (weasel.tulip.relay.mailchannels.net [23.83.218.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 2 Nov 2022 11:54:19 -0700 (PDT) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D6E6A7E1CB7 for ; Wed, 2 Nov 2022 18:54:15 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id DF64C7E0D5C for ; Wed, 2 Nov 2022 18:54:14 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1667415255; a=rsa-sha256; cv=none; b=wc0k0Mx+sHnLz3zHPDr9IXk3Oja45mSEJtxaGA3rX6kOfkMk2IRlzLLjFQ3q9Roobw9AwI Yz7UGyONNWuN1y0ldsdBhXsgP09co6bgyJDXS0zSCnQecJ0R7iKYzR2SmgYJ3Q2xcndmbV Lgzo/rymAyKThPgN+9So7FxJpXs4T0lRKZOmgQcv/M2dnVFasgAVH6MCqkdTdbrSnKsEf5 h3JARQDuYAJYsemkYTp5diF1hn/d8DcYKM0hXVBB7Cf9HCySaVcc8VGlyB00inQtqIuPCx 06hDckujNaZef1+2eJTC5RLRAgGmJ26WOWdkFKIraeYAvsYq3h696UPYJ2c/zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1667415255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QxAJHas6b4YUkX22HoLaLLGoa3GxTE8DmhX0fyRaSFY=; b=SXSSW5RuNmu5yDmQYBeINVpibSdVm4imuEZXvKZRGPeQXHKn/2M0owmOYscygIeABUlaCV 1/Xr7ZKAiVANs5xoaO7GGSWQIFVzlZsNxLnS/Z3moGhZbMrhcafz8MXcTIAFHkAnBBFW90 5h91xRlMHO49ew/PLqg3P6bRX+lxyJgfzLCzvfW2zqsK6zSf2JlM44BpbPu2eWqIRZBZT4 eiSHvORhOstKHvh3Jjx1Vs51IHXzD3DFvSjAufuPDEUD6o/qJocutu8mGIKmg2MzqzueFR cJw5esb+NVhKohH+C0Rpcsz7s0H23YnBRVWavvu1JQds2yedixbG2wCG5go70A== ARC-Authentication-Results: i=1; rspamd-7b8dfb6d4c-gtlhx; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Lonely-Cooperative: 05ee233d5a365eb7_1667415255423_1460586984 X-MC-Loop-Signature: 1667415255423:1154643593 X-MC-Ingress-Time: 1667415255423 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.229.7 (trex/6.7.1); Wed, 02 Nov 2022 18:54:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QxAJHas6b4YUkX22HoLaLLGoa3GxTE8DmhX0fyRaSFY=; b=EbDNzV9IT5Wiq4DBZyDojPDFTV gY0/8v2WR/q0Zf1jG5+29F6y3ZCYK1LGnHGfRCgRRoc838vLaGFw9Ok+Ic+V3nWI7gjtviZjc/kIS u5OctPBNuK5j1ytss1aqfIRiCryQjTSi3DBN2WflHvXiaKYTHBmOy7F78IvwaYNT/dwQ=; Received: from 86-154-178-143.ftth.glasoperator.nl ([143.178.154.86]:65370 helo=[192.168.1.104]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1oqIsR-00HRWJ-De for internals@lists.php.net; Wed, 02 Nov 2022 19:54:13 +0100 To: internals@lists.php.net References: Message-ID: <6362BCD4.6040804@adviesenzo.nl> Date: Wed, 2 Nov 2022 19:54:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------080005080106080101030702" X-AuthUser: juliette@adviesenzo.nl Subject: Re: [PHP-DEV] ReflectionType for iterable / PHP 8.2 From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) --------------080005080106080101030702 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 2-11-2022 18:46, Benjamin Morel wrote: > Hi internals, > > It just came to my attention that there is a change of behaviour between > PHP 8.1 and 8.2 in the way iterable is decomposed, or not, into > Traversable|array when reflected: > > ``` > function foo(): iterable {} > function bar(): stdClass|iterable {} > > echo (new ReflectionFunction('foo'))->getReturnType(), PHP_EOL; > echo (new ReflectionFunction('bar'))->getReturnType(), PHP_EOL; > ``` > > Output on PHP 8.1: > > ``` > iterable > stdClass|iterable > ``` > > Output on PHP 8.2: > > ``` > iterable > stdClass|Traversable|array > ``` > > Is this expected behaviour? Or should I file a bug? I'm particularly > surprised that it behaves this way on PHP 8.2 only in the presence of union > types. > > Thank you, > Benjamin > That's a intentional behaviour change and related to this accepted PHP 8.2 RFC: https://wiki.php.net/rfc/iterator_xyz_accept_array Smile, Juliette --------------080005080106080101030702--