Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128190 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id C2FC31A00BC for ; Wed, 23 Jul 2025 13:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753275546; bh=0xvtAwNWgX0LpRdtb9Ef6OgdNHf+rqmZU3ehbdXisdY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jZYJg3NGx7iGhBySzr0h4pSLkdu3T1WcDYj8fOvpVBpCnF/LFz7vTvcVzxScRTQVZ pn8KXl/juWzxsuBBM3phOmslnM58NaROaMoLrdz8MUZYgPClk5X4WX2zegwoHOYEZc b73KqfeW6DIxZcvxzRbNfb0lLiTM8SQQmZOv8aNb8nbOkO0a+A7H2GYGRhoaLEt7TE 889PhXhKUVFlCizruJAPlzXlkZQTCFGOnQIDiQpX9f2wB2jZt1z/Sw6EDELW8NDEEC C8bIbjt6zA5uEgdL61Y8f8Zrck6yqalOE1dJrJ8gn/XPwRwWTaLPZxuuCshXhPfBpg cXw4IWFkDITGQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E2578180074 for ; Wed, 23 Jul 2025 12:59:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 23 Jul 2025 12:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1753275649; bh=H8srbxYMCIm24rjWFzfwWF/kBYBw+ENcFMw0FVaWaqk=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=myN/mEfW81BJIH3rIy7ZsQfzVSdpemOGKitlf9J41KHEy9qOn7E1FRrdar33Tocwf Ct8SOTRqHxdFu4m03oWH84X8bWvh6RdDX3JXgMy+Vp6pC+XQmQJVDRy+tVABXdaQLE NcFVCu76ICnJqTfLyhLteOeS58xcJrwXrPVbhltpjH/0ukjJ73sS28REmGlT/jRYRu 50H/BTcWWkPlgd482+TXVfYnWs1OpSVwm+NXWN3hTHVTJaB0cPfkUQ3FAu9oK/G2gR oTPZ9SdoJQLmkwQQiwrgfZ8a4Plz8kNfwR688t3wfQDh6oDCCDfEsvsVJIEIEnd/wd jr/CQBPum4uIQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 23 Jul 2025 15:00:49 +0200 To: Nicolas Grekas Cc: "Gina P. Banyard" , PHP internals Subject: Re: [PHP-DEV] [RFC] Warnings for PHP 8.5 In-Reply-To: References: Message-ID: <8ed8808afd83f8c8ff962f81878b059e@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-07-23 13:30, schrieb Nicolas Grekas: >> About destructuring non-array values, null is a very common case that >> allows writing nice readable code. >> Here is a dummy example: >> if ([$a, $b] = $array[$key] ?? null) { /*...*/ } >> >> Turning this into a warning will have a significant impact for sure. >> Even >> a deprecation would just make the language a bit less pleasant to use >> without any real benefit, unless I missed any other rationale. >> >> >> If you want to provide default values, then surely: >> >> if ([$a, $b] = $array[$key] ?? [null, null]) >> >> makes more sense, especially as this allows you to choice different >> defaults for $a and $b. >> > > That's broken, the "if" will always be truthy using this style. > There's nothing wrong with the current code. It doesn't need to be > deprecated. It seems appropriate to mention the previous (declined) “Destructuring Coalesce” RFC at this point: https://wiki.php.net/rfc/destructuring_coalesce. Perhaps it might make sense to revisit that one? Best regards Tim Düsterhus