Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122546 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 qa.php.net (Postfix) with ESMTPS id B59CF1AD8F6 for ; Mon, 4 Mar 2024 16:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709380109; bh=7zmhHsoVtXKNjUhW8Uo9Cn/zou6pUJEXVxfoRpnUNkw=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=id0ZVi5qhJPO4AyCHLelC3TeF01//R3uKwVxxawEV4LVfiYuvT7AzUacJ/GSoFbEQ Cd1L2cf8V4kpKPc2iIIa0kCDqxyj15uGY1Mby0pfaQzteDFNOrYFS3dka8U+zJnoEU ISZwHQ+XYEfoxQQmWNqMYJhcigZF9fsSo2MgDmFMHwsCcjIs7yjAapR5gEkdSlrEN8 wh/oFmgyaIsa6gDKwI8wF94KMOAj3xm2Usr088TKpnako5jdcXt2HiC5ghLQ9ZJnx7 X3sV/y2sdlUcGE7b0gmU8wpEL9nNtP9NF1oVk5l0/+Af1GrUVYed+4Y5yaR8cg5LBc 97qvuZLnRn5tA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 81956189171 for ; Sat, 2 Mar 2024 11:48:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) (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 ; Sat, 2 Mar 2024 11:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail; t=1709380092; x=1709639292; bh=7zmhHsoVtXKNjUhW8Uo9Cn/zou6pUJEXVxfoRpnUNkw=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=D2PJx10oxszJ5JtPmkizGLcC35whuZm7rwabjr9tvvhFIMM38XIymZBfI6IAFPYYj l9+Uxs/3Ybj7ms7l7EP5ey/yeFO6iDiQ5ZwBbw3uXmuwcZNX2lgBMWmmpdUEMhWiKk Nec2P47u9euOsLUflgui8bQkAauE79Vt+pqDcK4gaFQzDGwz0vmSNWjrVsdkZ2eWWo QjZmYaxbsPvLc7/eHbU+GSXTV1c1vYsfCKggimlzK7EkzY+Ud5Uzi/xCK4xMcXM0Ch eQcqr70fVNZQw0bBV8KKWjTjZhi80MtuFTsG2Iav2/kkmh67LeYinp0K7p0g19glE/ w0jVPl1f2K42A== Date: Sat, 02 Mar 2024 11:48:00 +0000 To: Stephen Reay Cc: Larry Garfield , php internals Subject: Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2 Message-ID: In-Reply-To: <115C4A93-120E-45A4-85E2-D91649B66E70@koalephant.com> References: <59619244-917d-4936-8f21-2854840a9bf8@rwec.co.uk> <2299271f-50ea-48c1-81fb-b64fa10c9bbb@app.fastmail.com> <1204BFC3-B976-4FEE-BE01-E668699C84E2@koalephant.com> <115C4A93-120E-45A4-85E2-D91649B66E70@koalephant.com> Feedback-ID: 96993444:user:proton Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Friday, 1 March 2024 at 06:28, Stephen Reay w= rote: > For the third time: I'm well aware of how parameter types work everywhere= else, and that's why I'm asking why the same behaviour isn't being followe= d here? >=20 > - You've said you want to avoid boilerplate; and > - You've said you would expect most people to just use the implicit `same= -type $value` parameter; and > - You've acknowledged that the existing 'standard' is that a parameter wi= thout a type is considered `mixed`; and > - You've acknowledged in your RFC that there is a use-case for wanting to= accept a wider type than what a property stores internally. >=20 > So why then is it so unacceptable that the existing standard be followed,= such that a set hook with an "untyped" parameter would be treated as `mixe= d` as it is everywhere else? >=20 > Yes, I know you said "widening to `mixed` is unwise". I don't seem to rec= all amongst all the type-related previous RFCs, any that suggested that chi= ld parameters widening to `mixed` (either explicitly or implicitly) should = be deprecated, so I'm sorry but I don't see much value in that argument. Deprecating this behaviour would effectively mean, types are now required e= verywhere, which is an unreasonable proposition. The "implicit" widening to mixed is something that got introduced _after_ t= yping was introduced to PHP, and quite "late" even (in 7.2) considering typ= ing objects/arrays has existed since PHP 5. [1] I don't think it's unreasonable that if property access hooks only work on = typed properties, having no type means the type of the property and if you = want to widen the type you _must_ specify a type. Especially if you want the backing type to be mixed well you are just requi= red to write a typed property with type mixed, same as readonly. Best regards, Gina P. Banyard [1] https://wiki.php.net/rfc/parameter-no-type-variance