Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127609 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 275181A00BC for ; Thu, 5 Jun 2025 12:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749124748; bh=tIjYCZWriXYwOOIwfFHi15fF2SEOZzPTWIve5tPNRvM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BGicYC0tX3a1YS877KAemvldDCXxkkSbb/ogzgeNfAamem31m9DfzceH0kasWOAWX NQVvyEC76c0m2mQoejstDSyYg2ss5awDbLd5VC8ieGsWBKuNbnuSY/BO6dn2JNVZoH 9g3Gvo9uDjbHmsYCIAbhwbmEk5cpWLOCL3bxU+AQynKiVqb43yFwjL6JsZg5wCQAz0 Fkz3dAQAnOoO2JDALUDYXcN4ORCyQtKWuthf0BYnGjgNTBhaQDSFhAU9mGvU+t/ut5 Ci/8Lr9Is/qJ5wtWD0VgiZuLo4FT669sjUEJHbhaChwEjRLmtV/rWod10kQ/Z1DN1i Itnmcrjs+XLTw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4FCB7180053 for ; Thu, 5 Jun 2025 11:59:04 +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=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_40, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2063.outbound.protection.outlook.com [40.92.89.63]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 5 Jun 2025 11:58:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R/WzGchgVCNIhoF3bui57+CAXP0QlKOoutjvMzSYppOEG74Sbte6VwQ9S0MLFA1Fem4sJYnyfdweUsbwkJh09LZ19vxoFVVMWqFLeVeY7wB81x1eSUrfahqKlHoMTc7SshXB4BvUedXFkcrUe1o982L9ola0W0XrbnITbZxk99TuN07gQRec4Gt935GiQv+zdwAnEOeXw8+4+nPba2zORQOJNnHrXI52FLznOviWaDBlH3+dcPMmTvJpE6BvBo8r6OnTut23Yim92cdFCIfGrNwOAYOkzSjkK3fueS8GEm5rlvhufq52ZWdeHuTxqewpKbxMxPFX2tlqcWtZwJGYeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7ZGeen7cAtTz6Wl1hFTyumBjqPzNM4PuJ5iuNhm7/qc=; b=jaiqTf+1uyIvhKM98QHJmpQOKJTkGiSTGE57nIosBtmZUiT0s4IdSUVz3ixkXweMdjU1uut+sLbeVyUmo0o8f0vMa//Zr2Hsx9vnph26wDXq6U6Ow/VW6W/vRxiwj17NbBWrZiBlM6AWY6chnS2iuZh5ZE974TIiLVjyUgbYGimHIaNSkHd5WML5KWBGG5DGTvmz5ZFoTuXEBSp2hWl9YedsCaCC52ZujDbT9SNYxOwY3Yj1RvKoza919mOlNhdxZgyXvUWLsmwaR1OwQvXqmSTgSvCdK6CghcyVOX0l4ZZHVHOn51/oLwII2+oAOzlujJ6e9rEPYtRHRhAT+QuqZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7ZGeen7cAtTz6Wl1hFTyumBjqPzNM4PuJ5iuNhm7/qc=; b=bSW5zRlLQtk4sk4Z7EgvFAB8ed7KukjAxiZbPK5jrMz7U3stNb8Ia3aEJsa3TIHGRVzR8/VzxZbf7IdZC1fBWd/jFA2+jvbxT0ickvqFrPi8VRbDpjkvaERGEgnu3+651SQhUnhSRhZkD//8EUCy6SoVzpfzDK3wH0PmMtBhUWADWDrgQSL+3v4rQa5CtoCHAHqf3xvOVk30uT/5iImP5bW70zkbh9ei49AV6mtRPqVLf/jZQTRSF1qkOAff7prmVy82YY7GAJI2c7L9w1a8DkIkXZjF0Mv6+XsESy1bd66cQsvP6oDwZ+LRNr2Wqc3/zqREhKPMwa9VBBhExo6EXg== Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) by PRAP250MB0616.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:297::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.34; Thu, 5 Jun 2025 12:00:55 +0000 Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff]) by AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff%7]) with mapi id 15.20.8792.034; Thu, 5 Jun 2025 12:00:54 +0000 Content-Type: multipart/alternative; boundary="------------NMxpA6yxPxcaEnr5pi4xnjD0" Message-ID: Date: Thu, 5 Jun 2025 14:00:53 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Transform void into an alias for null To: Daniel Scherzer Cc: "Gina P. Banyard" , PHP internals References: <6Z2Ysh6MjYp1nyzuB0bTPJc5srObIcMRqt731JaQeXUJk1f_V_Yo2nRn8WvjI7er7pp7pIUE6WYl5pRwvYrtcrd07nCutyAqKPSsZHmrS-Y=@gpb.moe> Content-Language: en-US In-Reply-To: X-ClientProxiedBy: FR4P281CA0024.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c9::15) To AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) X-Microsoft-Original-Message-ID: <31c01c55-bfcb-4b66-81ac-9d7e77589db6@hotmail.com> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8P250MB0170:EE_|PRAP250MB0616:EE_ X-MS-Office365-Filtering-Correlation-Id: d4e0059a-d6f1-4faa-cfeb-08dda4289fe9 X-Microsoft-Antispam: BCL:0;ARA:14566002|461199028|5072599009|9400799033|41001999006|8060799009|7092599006|12121999007|19110799006|15080799009|12050799012|1602099012|4302099013|3412199025|440099028|10035399007|26104999006; X-Microsoft-Antispam-Message-Info: =?utf-8?B?N0xTaHR1ZE4vRStwOGFtZEF3VHJuTCtHUU1WeXVQSXh5bThtYVcyK0tUT2xi?= =?utf-8?B?RUJvRW5zRTVYQlAvOWZNODk2eXQzVmY1SjlmT1pDaWR3cDFzeG82T0hBTVNJ?= =?utf-8?B?ZDAvb0lRbk9NMVA3QTMycm9kcTdINnVmT3BEUG5rV3RVWjZTVFdnUG15dS84?= =?utf-8?B?MXpZZ1lyN0hEc2xRY1EzT0V2UFJjZ1p1QzBPSyt5N3oyS2FGWmpDOXV5L25U?= =?utf-8?B?M0FQZHd0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cWtIeTVaZWFkVVlad0xGMTQ5?= =?utf-8?B?WmlQMkhwQStyQ1BIc2paYU5jK04vRGVmVWtoMUdvbExHa0NadFZtMlBYV1VQ?= =?utf-8?B?Q1NDOTRHaE5uQlpXMnVXbnVQVkdtYzlVQThGc3BKS0R4dWZyVkZNSWxsNHRH?= =?utf-8?B?TzA3ZUcvNEdIQ3pSRklTSTVvbjAyWUh6ak5waGI4L0d6VUJRaHFQU2U5SDd4?= =?utf-8?B?VW1jdC8rRlFIVXoxZlNIdk5HaTUxNGNXTW0rNlRTWU1hdW1nVFNVNnlHS0la?= =?utf-8?B?UTgwb2gyRDl3VGxUd3lmamtNcGlqOFJVd2JIUmxLRGIvbS9qcE1Ta3V3R0pq?= =?utf-8?B?QnBPSjRGUnU4TDVSYXRlUDJXYjdVWlluTndWaytVVmluSmVTc09ROWhRSmsr?= =?utf-8?B?Z21Dcms4dTNQampyV1ppWnFrTGJEdGg3ZURsVXhaYmVwbEMyL1I3M2pzbVNo?= =?utf-8?B?M2tjYks1VmZDNUJKR1pOd1FDRFdVQmJhSlljNmxLM2JyaDhVa2tFZU5wYmRD?= =?utf-8?B?dVVZWFhmRE9tc2dzZU0vZXNEUlIzNDJ3ZURyWUZWSDRmSEtISEVBSlVYOEVm?= =?utf-8?B?WUtVSTUyTWZnVlBDMFEvZ0lLSWhIR21LbXFyZzcyQVZpMEVSZ2hnQnVCcHBF?= =?utf-8?B?ZkVwQlNVV3NJRUgzZHY0ZVlqMktOWjNhQkdscDc5T0lpWW5MS2RDck1wV0Zj?= =?utf-8?B?SnVTbFVlWHhXSFF2YXJuNFMrVGtOY0t5VkxWNFl0dFlhN0JWa2lxR1VzQjVQ?= =?utf-8?Q?MamDsDOxPM6PIB1pQI=3D?= X-OriginatorOrg: sct-15-20-8534-15-msonline-outlook-5f066.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d4e0059a-d6f1-4faa-cfeb-08dda4289fe9 X-MS-Exchange-CrossTenant-AuthSource: AM8P250MB0170.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2025 12:00:54.9403 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP250MB0616 From: bobwei9@hotmail.com (Bob Weinand) --------------NMxpA6yxPxcaEnr5pi4xnjD0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5.6.2025 02:59:56, Daniel Scherzer wrote: > On Wed, Jun 4, 2025 at 4:49 PM Bob Weinand wrote: > > Hey Daniel, > > where's the BC break? Nothing which worked today will stop working > (except you won't get exceptions in some cases). That's not a BC > break. The only thing which stops working is if it's intentionally > used as a guard. > > > That (intentionally using `void` returns as a guard) is exactly what > MediaWiki does. MediaWiki has an interface for each hook, that > requires that hooks that cannot abort (return false) must return void; > https://www.mediawiki.org/wiki/Manual:Hooks#Handling_hooks_in_MediaWiki_1.35_and_later. > PHP is used to help enforce this. > > However, in the case of MediaWiki they do actually _care_ about > the return type (and the caller of these hooks will actually check > for null/true/false). So it should be annotated ": null". And not > ": void". Explicit intentions are important. > They probably still use ": void" as to be compatible with PHP 8.1 > and older. ": null" is only supported starting PHP 8.2. I'd assume > as they upgrade their required PHP version (8.1 currently) they'll > shift to ": null". > > So, yeah, the guard will lose its guarding functionality (but we > don't consider that a BC break). > > > > Why is this not considered a BC break? You can consider it a small > break, but I think it should be noted in the BC section of the RFC. It's a small break in the sense of workflow, but *compatibility* breaks are concerned with the behaviours of non-erroneous functionality. (Code with worked yesterday works today. And not code which did not work yesterday works today). But sure, the RFC may indicate it. > Regarding why not mixed? Because the intention with mixed is that > the value is something meaningful. With void it's meaningless. > There's a semantic distinction (and it forbids returning). And, as > proposed, you could forbid direct calls of void functions giving > runtime / static analysis hints. With void being covariant with > respect to child functions now. > > > Bob > > > If `void` is a top type indicating a return is meaningless, then > callers would have no reason to examine the returned value, and then > when subclasses do try to add meaning it might be missed. Am I missing > something? How would void be different from "the base implementation > happens to always return null, but subclasses can return other things, > and the result can be meaningful"? > > -Daniel What LSP builds upon is "if I code against this interface, my expectations will always be fulfilled". If I code against the interface returning void, I do not care about the actual returned value and such my expectations are always fulfilled. If I code against some subclass (or any of its children) which has a meaningful return type specified, and I'm aware of that return type, I may for sure use the return value. Nothing requires me to actually use the return value. It's similar to optional parameters "When subclasses do try to add optional parameters, they might be missed". That line of argumentation is a bit absurd :-) Bob --------------NMxpA6yxPxcaEnr5pi4xnjD0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 5.6.2025 02:59:56, Daniel Scherzer wrote:
On Wed, Jun 4, 2025 at 4:49 PM Bob Weinand <bobwei9@hotmail.com> wrote:

Hey Daniel,

where's the BC break? Nothing which worked today will stop working (except you won't get exceptions in some cases). That's not a BC break. The only thing which stops working is if it's intentionally used as a guard.


That (intentionally using `void` returns as a guard) is exactly what MediaWiki does. MediaWiki has an interface for each hook, that requires that hooks that cannot abort (return false) must return void; https://www.mediawiki.org/wiki/Manual:Hooks#Handling_hooks_in_MediaWiki_1.35_and_later. PHP is used to help enforce this.
 

However, in the case of MediaWiki they do actually _care_ about the return type (and the caller of these hooks will actually check for null/true/false). So it should be annotated ": null". And not ": void". Explicit intentions are important.
They probably still use ": void" as to be compatible with PHP 8.1 and older. ": null" is only supported starting PHP 8.2. I'd assume as they upgrade their required PHP version (8.1 currently) they'll shift to ": null".

So, yeah, the guard will lose its guarding functionality (but we don't consider that a BC break).



Why is this not considered a BC break? You can consider it a small break, but I think it should be noted in the BC section of the RFC.

It's a small break in the sense of workflow, but *compatibility* breaks are concerned with the behaviours of non-erroneous functionality. (Code with worked yesterday works today. And not code which did not work yesterday works today).

But sure, the RFC may indicate it.

Regarding why not mixed? Because the intention with mixed is that the value is something meaningful. With void it's meaningless. There's a semantic distinction (and it forbids returning). And, as proposed, you could forbid direct calls of void functions giving runtime / static analysis hints. With void being covariant with respect to child functions now.


Bob


If `void` is a top type indicating a return is meaningless, then callers would have no reason to examine the returned value, and then when subclasses do try to add meaning it might be missed. Am I missing something? How would void be different from "the base implementation happens to always return null, but subclasses can return other things, and the result can be meaningful"?

-Daniel

What LSP builds upon is "if I code against this interface, my expectations will always be fulfilled". If I code against the interface returning void, I do not care about the actual returned value and such my expectations are always fulfilled.

If I code against some subclass (or any of its children) which has a meaningful return type specified, and I'm aware of that return type, I may for sure use the return value. Nothing requires me to actually use the return value. It's similar to optional parameters "When subclasses do try to add optional parameters, they might be missed". That line of argumentation is a bit absurd :-)


Bob
--------------NMxpA6yxPxcaEnr5pi4xnjD0--