Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128572 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 92B821A00BC for ; Wed, 27 Aug 2025 15:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756309486; bh=Qc4lC8x9fuuUO/hci5afulBiMKv334WWgDbM7ahcvnc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=S4SD3M5ZoCADDXM+nN11mnoy1Pj/YdudN57i5EgnQAmPXWXo1Kzn3O8qngRLaoRV+ ZxDaaC/Tu8D08tGT7P6XaxpGip30PSFRhYWPeoOxhaZllTrRx4KYQZ7Y2ChgHtmt8F jYjuIB2WkA7MQxJ5JnqPpl19kchJwOl74Av8ZSaUFvsYP4Q/n1jGu1vJgdccAy6Gpp Swn1XLZTuplxTm4cZLOMC20THVpKiWKfkRCUpHFUznEoat117sB3VAqDc7DB1zkNP8 jghF/D/c0sbSRPdfLHf98yePzRNa22UKTkDo76+kf8GVDbLmQ4uPK2cmpr4fHZhvhR 14KdohPjZyFQA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 25B46180032 for ; Wed, 27 Aug 2025 15:44:45 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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, 27 Aug 2025 15:44:41 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-3252c3b048cso3728197a91.2 for ; Wed, 27 Aug 2025 08:46:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756309573; x=1756914373; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SyWFP/gvX05lpjvS0qSKGL8ZBwGgag9xQoxjXDB6FLI=; b=Zh6MGuS/RwftphaVp3jjzTOUxPidhw+J+Oc6vuoeq5HlMaeC+akz+e5zqOgPt71WZW RNazNnFIqtLl2GlL0ns/j/2aYWuaKUUUGklX5vMnuYJSQ/piKBDP8H2BEciwBO3+ateA YEFvuPMb494jDKor1GYIne+rR2Xn+coCEHFNj/EcH9QKI/p9uETG3Zqm1v/AtBEewvma KPEVwNeEwz7ldzQkKPSD7jehoUivqQRJSesP3GBi670pSJZmE3KS8yVpA70WoBL04StY BuGBek+vSHGYkHWo6Mtgy/f8Vcw8kgUQjxvNnmjfTaQSgkQeEM4vPIeC7MIHjQhr64yF Dtcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756309573; x=1756914373; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SyWFP/gvX05lpjvS0qSKGL8ZBwGgag9xQoxjXDB6FLI=; b=clvo7ExCLYpFJr4gsFuwcYoj4LJRKvQP3+8WRM3OHQ0VIhGXdhNlulhnoxYaaUoMOC m5q9o+qSo7a6iyA1IMtFzL+1MnokB8SOxZToKw3A5EtnjbLIHiZWWY5UkZ1FgRvrJKOg jiJcsuOcLhi4EbMXiUICHvau2kGCdny04Bj1mkrSQHs5b3N+jFYCRMXuW7xzwZ1rhHth rZNLVq4PRCebXJpdkUqj9uN029MITreB+Nc/bdE+yQx021sHWdURTSERpLqG/2wFJPAU BSqdoNkW84AWed7D/pYuL717IB2VEDS5/zIpZktymAxynXJVasZObBiX6WcCAu2ePMd4 ulHA== X-Gm-Message-State: AOJu0YzxBKmgeeolhYzW2TFUTUAEtO5B2OOxVCzh3pgkq/7xE/4nPX8o 9ihOL9/BGux9UnjpFyI+ufLQcir2yEadcjH0txL9XDFSwmYhf7LHKRN1fNtESkr5ESJZ80wz1t9 rLP28KRh4ZQppvHD7e9jUf/HYuClQUSA= X-Gm-Gg: ASbGncuIa1gPJIp6DYZi/64QNdpCLubJrr/2ozcVr3ICr6zou52miFO38SgORJo1i7J 6BwI3ZdWmDgDCEG131VNJWYqpEZWMI3VTVSGPpkHaJH5OGofqKnOoiP7FKJBF3f1Y5FMnZ7AbJv FdWx8sElTfmlU/r18jxaQl6Q/ChHkkUPp39ZVrHFSfK2cu3jXXmMq/lRXUm/twFf/HXf7aOta9z yBlUmAm X-Google-Smtp-Source: AGHT+IGRoLmvFjqhf5WJuvuYTDV6uN5gonIidHO51kbdjhqI1ReX+QfVp5NTnV0qq0Sph+e1laPMgw2395ioe7bCE4w= X-Received: by 2002:a17:90b:5343:b0:31f:5ebe:fa1c with SMTP id 98e67ed59e1d1-32515e1976fmr25917762a91.0.1756309572476; Wed, 27 Aug 2025 08:46:12 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 27 Aug 2025 17:45:59 +0200 X-Gm-Features: Ac12FXw4GT5XDOoO9kebJDqaLaN7hg8ru01oSpn3Y9_u_LpFJQp8qHQGxyKiX_4 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add clamp function To: Kyle Katarn Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002ee358063d5ab0e8" From: ocramius@gmail.com (Marco Pivetta) --0000000000002ee358063d5ab0e8 Content-Type: text/plain; charset="UTF-8" Hey Kyle, On Wed, 27 Aug 2025 at 15:35, Kyle Katarn wrote: > Hello, > > I handled the feedback received on the draft RCF > https://wiki.php.net/rfc/clamp_v2 > I know this isn't very used in internals, but does it make sense to write generics for the generated stubs of this function? Specifically, I'd expect input, min and max to be bound to the same exact type: ```php /** * @template T * @param T $value * @param T $min * @param T $max * @return T */ function clamp (mixed $value, mixed $min, mixed $max): mixed { // ... } ``` Greets, Marco Pivetta https://mastodon.social/@ocramius https://ocramius.github.io/ --0000000000002ee358063d5ab0e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey Kyle,

On Wed, 27 Aug 2025 at 15:35, Kyle Katarn <kylekatarnls@gmail.com> wrote:
Hello,

=
I handled the feedback received on the draft RCF=C2=A0https://wiki.php.net/rfc/cl= amp_v2

I know this isn'= t very used in internals, but does it make sense to write generics for the = generated stubs of this function?

Specifically, I&= #39;d expect input, min and max to be bound to the same exact type:

```php
/**
=C2=A0*=C2=A0@template T
=C2=A0*=C2=A0@param T $value
=C2=A0*=C2= =A0@param T $min
=C2=A0*=C2=A0@param T $max
=C2=A0= *=C2=A0@return T
=C2=A0*/
function clamp (mixed $value,= mixed $min, mixed $max): mixed {
=C2=A0 =C2=A0// ...
}=
```

Greets,
=C2= =A0
=C2=A0 --0000000000002ee358063d5ab0e8--