Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126705 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 C23D01A00BC for ; Mon, 10 Mar 2025 23:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741647462; bh=5S1wmcYeBUTLPDGTtMuoSyX09W2jEITdGevQ1ukZi4E=; h=Date:From:To:In-Reply-To:References:Subject:From; b=ANgwef6LeBHTwKpFlFCUuR0isnMy7Mx/5FftRrRZPj3qNnyj09uOomtt/6KcFKY1E M3p1Lzy3F3Z3oFCHXFVNBHMV645GPxCsD1OVYGGxt9LuAUNb2ocPh/MGRs0pX0w9Gc a+r0zFNme6pOoQSSgxXkQBQtatygDgVgg4ZWlCehU0lxajIBw85G4esZ+331l62PjY gAiMXYWYkFC4e5ezjNwQbs/2LBBZOzw00iHkR/lCuaL1wSHm0T+GrAiqeUSud2S6GF UwCott1ZegqxMdElSClvcwQOJjza/v2kvDV/aZ4zIjF/t196bXoF8VnjEteh6h4Kbc ZhzuI9f/mdyDw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2AC6B18054A for ; Mon, 10 Mar 2025 22:57:39 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (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 ; Mon, 10 Mar 2025 22:57:37 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 82F892540273 for ; Mon, 10 Mar 2025 19:00:11 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Mon, 10 Mar 2025 19:00:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1741647611; x=1741734011; bh=s714PDgqtY WTvGHlXc2J4DvWAwABk5XAOLyCY5TqGUk=; b=XH64ZrxTsX9D+nOO67CUbpb27u T+l7g2bRQjX1ybZXOsEssDTSkw7u5bTHgZP5ggHlz0BZkOMrlUr62NB6cF4ds7mF arKTzOQoO70C0BM1da4WfFhgYQ2eJEOBFgt8+Edmex6PaL8p1HeYfr6H+uNcTtWl Ekw2CAY+vhFQGCQZVMVqEkNEvXBG9HgzlD5CfSHaKJZmE66qk6tr03TVCJ0AnAIm szR2iNmUvnA6ZgUgYD7mrqIsqo2HcSeseyFkQM7bA3jFjfBfuZgbKz2cKrVrHpYU /C9oSKBbk/1wENxYzvOL7+Mnv9RKac87SmtNqClOn+D++iY+hNU9sgBrELUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1741647611; x=1741734011; bh=s714PDgqtYWTvGHlXc2J4DvWAwABk5XAOLy CY5TqGUk=; b=TtyGh+ddurEt15qw30U1JDG/C9yZCKpeULjU5+G5JvM7Uo8lvRy xftREhx2sMRqMPYN85tTnbmPH4dtDe5lHwixb960culL9smuvr+zvHTF0ACEIO/S b9SK6YH3jLiAkbKKJbX8DbduNtpsp0ao+p/CO/Jg8jL8EVmkraOeFqkJ3pnghJjo IRcDu0H5YpKXQSTYCI2lxhPjY1tyNSUhOKr+tjPopKIXWXhEA18i5XcqKMhn1gOV P6hD7YiVWfLYaJHHQFjuikbKC3KuYSEOURqpnebfnjUTPjQOF3PQbg895613oVPx X97BfXJ8OWXqSPhKPZoL6dhUEUpccoDCGrQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvddtieduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhs fdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpeehie ffkeetleejueefjeffueffheevudfgteevfeeijeevfffhhfegueetteffleenucffohhm rghinhepphhhphdrnhgvthdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggv shdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepih hnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 07375780068; Mon, 10 Mar 2025 19:00:11 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 10 Mar 2025 23:59:49 +0100 To: internals@lists.php.net Message-ID: <11584084-56ae-4775-8ea6-05b09eefca17@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] [Discussion] Never parameters Content-Type: multipart/alternative; boundary=bc1f03e3ec804400b0de00faee3397ce From: rob@bottled.codes ("Rob Landers") --bc1f03e3ec804400b0de00faee3397ce Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 10, 2025, at 20:05, Daniel Scherzer wrote: > Hi internals, >=20 > I'd like to start discussion on a new RFC about allowing `never` for p= arameter types when declaring a method. >=20 > * RFC: https://wiki.php.net/rfc/never-parameters-v2 > * Implementation: https://github.com/php/php-src/pull/18016 >=20 > -Daniel Hey Daniel, This looks interesting. I'm not sure that I like "never" as a parameter = type and while it "technically" doesn't violate LSP, it seems like a bac= kdoor to doing just that: abstract class Point { function add(never $other); function subtract(never $other); } class Vector2 extends Point { public function add(Banana $other) {} public function subtract(Football $other) {} } There's basically only a gentleman's agreement that a subclass will impl= ement things in a way that makes sense. I would also personally prefer a= ssociated types: abstract class Point { public type OtherPoint; public function add(OtherPoint $other); pubic function subtract(OtherPoint $other); } This at least lets you ensure the "other point" is the same type in both= functions, though personally, I'd rather just have generics. =E2=80=94 Rob --bc1f03e3ec804400b0de00faee3397ce Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Mon, Mar 10,= 2025, at 20:05, Daniel Scherzer wrote:
Hi internals,

I'd like to start discussion on a new RFC about allowin= g `never` for parameter types when declaring a method.

-Daniel

Hey Dani= el,

This looks interesting. I'm not sure th= at I like "never" as a parameter type and while it "technically" doesn't= violate LSP, it seems like a backdoor to doing just that:

abstract class Point {
  function add= (never $other);
  function subtract(never $other);
}

class Vector2 extends Point {
  public function add(Banana $other) {}
 = public function subtract(Football $other) {}
}
=
There's basically only a gentleman's agreement that a sub= class will implement things in a way that makes sense. I would also pers= onally prefer associated types:

abstract cl= ass Point {
  public type OtherPoint;
&= nbsp; public function add(OtherPoint $other);
  pubic= function subtract(OtherPoint $other);
}
This at least lets you ensure the "other point" is the same = type in both functions, though personally, I'd rather just have generics= .

=E2=80=94 Rob
--bc1f03e3ec804400b0de00faee3397ce--