Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:117120
Return-Path: <duesterhus@woltlab.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 59359 invoked from network); 23 Feb 2022 12:22:14 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 23 Feb 2022 12:22:14 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 419591804D0
	for <internals@lists.php.net>; Wed, 23 Feb 2022 05:41:58 -0800 (PST)
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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=3.4.2
X-Spam-ASN: AS199118 195.10.208.0/24
X-Spam-Virus: No
X-Envelope-From: <duesterhus@woltlab.com>
Received: from mout-b-203.mailbox.org (mout-b-203.mailbox.org [195.10.208.52])
	(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 <internals@lists.php.net>; Wed, 23 Feb 2022 05:41:57 -0800 (PST)
Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-203.mailbox.org (Postfix) with ESMTPS id 4K3cdw2Q0nz9sRT;
	Wed, 23 Feb 2022 14:41:56 +0100 (CET)
Message-ID: <d5f2c8f0-62b4-2ca6-a9c0-b1ddf512616b@woltlab.com>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=woltlab.com; s=MBO0001;
	t=1645623713;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=GhY6YHkFyCqUXJxOQ1+lqH2iXc1851PWoZwjnDpWsjA=;
	b=cQR3AgUZlKqhw5xHo+M3AEDi5CV5OatzXp0tAlG0YMM1lV4Qe2ETEedRzGVSVt6EX30Lg1
	auJHreR0SuvYvfJ3y8TK9Fu4qFRrNUBKCPUQTBJfFYrytEI9as/MydGp+fScboDtAGmZrf
	iKmcJLfy/+aEE1A7/m3n2LXtpLjOIZtJGcn5KxBY3zROi4xtWwD6XyxX1CiTLBzx0H2YDV
	Nnv1WZcjQjPKewasyHe2pikgWXTxlFtxjVqRBg/3w7CPVoyyi6aX6s1dT0FTil1lz5Rd8I
	pqytb2ZkrPf3h2H346lD3HRn3PgsJs3NIL8stJk4ouW0fZMYEuSs0Qw7AlsO7w==
Date: Wed, 23 Feb 2022 14:41:48 +0100
MIME-Version: 1.0
Content-Language: en-US
To: tyson andre <tysonandre775@hotmail.com>,
 "internals@lists.php.net" <internals@lists.php.net>
References: <DM6PR14MB41557A1D56484251B5F9AF37F9329@DM6PR14MB4155.namprd14.prod.outlook.com>
In-Reply-To: <DM6PR14MB41557A1D56484251B5F9AF37F9329@DM6PR14MB4155.namprd14.prod.outlook.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Subject: Re: [PHP-DEV] Adding `class UnsupportedOperationException extends
 RuntimeException` to php?
From: duesterhus@woltlab.com (=?UTF-8?Q?Tim_D=c3=bcsterhus=2c_WoltLab_GmbH?=)

Hi Tyson

On 2/13/22 16:50, tyson andre wrote:
> Currently, there doesn't seem to be an exact fit for indicating that a method isn't supported on an object by design (and will throw unconditionally).
> (For example, when implementing an interface or overriding a base class, e.g. an Immutable datastructure not implementing offsetSet/offsetUnset,
> an object that does not support serialization and overrides __serialize/__unserialize to forbid it, etc.)
> 
> […]
> 
> Thoughts on adding UnsupportedOperationException to the spl?
> 

The "Redacting parameters in back traces" RFC has the same issue for the 
SensitiveParameterValue::__unserialize() method [1] which is not 
supported by design.

In userland I'd commonly use BadMethodCallException for this purpose, 
but thinking about it: A `LogicException` is not really fitting for the 
reasons you outlined.

UnsupportedOperationException sounds like a useful addition to me.

[1] 
https://wiki.php.net/rfc/redact_parameters_in_back_traces#choice_of_replacement_value

Best regards
Tim Düsterhus
Developer WoltLab GmbH

-- 

WoltLab GmbH
Nedlitzer Str. 27B
14469 Potsdam

Tel.: +49 331 96784338

duesterhus@woltlab.com
www.woltlab.com

Managing director:
Marcel Werk

AG Potsdam HRB 26795 P