Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123251 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 51E131A009C for ; Thu, 2 May 2024 12:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1714654187; bh=mxJOr9QXsIKtY+eOjXajEh8cbUrhYqnNcvYB360kCt8=; h=Date:From:To:Subject:From; b=kJF+EQfMsIKdj6LE58KofKGC6A60aYqA82MJkgMNTrIIY8atbwzoO0YvxA2M+bzen wZc/4QlnGkbatrUAbZgFi+86rfpLFEx8gEX/HkG8BT5gvSgGTcv5ZTXB65R+9+8ZsC jCC6r9OZz64xXO7t5hKi0Px7BnJYH0g1bsDT1o2Oulo/XPb5MF0Rxdl2+nTyhI1aQH 4Xo9bovDKChevogD8dMSHKddUWrpE7Yi0tuFMhxqzxDtsM5T3txQ4ZJx6qcreSLxB3 Ea3LLWOSajaT3cgWX6U+kJeSVaL2fVacHq/maxhFpYt++/02+OSRNCx5xlmoxR9yRP 1W3HS/RlKP47w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E2FF5180079 for ; Thu, 2 May 2024 12:49:45 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,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 wfhigh3-smtp.messagingengine.com (wfhigh3-smtp.messagingengine.com [64.147.123.154]) (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 ; Thu, 2 May 2024 12:49:45 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 8727F18001A2 for ; Thu, 2 May 2024 08:48:58 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute2.internal (MEProxy); Thu, 02 May 2024 08:48:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ollie.codes; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1714654138; x=1714740538; bh=mxJOr9QXsIKtY+eOjXajEh8cbUrhYqnN cvYB360kCt8=; b=Fm2pqbX+4UbDLwSrO+aveiAED95pWA/exwo/hk/eHekFRQN4 sBJdZSVr6oRFLxJhhF3KnWzvUmgTEZUzIqCAdcntbtjjLrjwDoeQtZ0rI7XpGs++ ttX3KmoX2wQaYPiiXdAhNEXWZPVV9tY94B9h0D0DNuwFwz9GzrYLX/h1dUjOeLY8 Ci/bFkZwIm1kYzlVUpLoIqAxZkYq5gFHIR0aCSQOe80fT2URAHljmbAKA7DTDOr+ 2XuhWjLGp24AujZXE0MhEHlMN6JVS6ckHGY0LBcrWd1VFerJ/54wUFmvTGhNpOsB 9famSOPBq5qe7KOwBpjEp7MCNCFiaAclBt+Uyw== 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:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1714654138; x=1714740538; bh=mxJOr9QXsIKtY+eOjXajEh8cbUrhYqnNcvY B360kCt8=; b=OqRIPaR5yhb6NZBIC8dFHg2y51o132Tl9BNB1bjWNRcAbYXooNg fDKYZpYhxlKuDECVyxI5LZXtr4MwhGecdG2VqnEznZ5CSrJd1nJulDjeErWiK1mB LOMDN4MnY+Bf1w16Ok157siyIVPpHpOyCx7NLD0TeXMIufEw7xB+n/2FYTas4GVw Vr7DGUGsDKllaQYhxXzM9hn97iqVMn+vT5wDbOtJJ8cPag1nCHrsSOd58e3w9Rlt A8Tj45BzbVL0fylNq9wvyxB6fW/+lmn+Hgai8y6e+eEnpe1VgkCihvjR/RyB1v4U AGT4wDT2B/G8Ed0N8lyhzDpG8JCypvvK/dA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddukedgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsegrtderre erredtnecuhfhrohhmpedfqfhllhhivgcutfgvrggufdcuoehphhhpseholhhlihgvrdgt ohguvghsqeenucggtffrrghtthgvrhhnpeeghfetkeegheeijedtleeliedvffdutdetue etueffhfefjeevveffuefhudfgleenucffohhmrghinhepghhithhhuhgsrdgtohhmnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhhphesoh hllhhivgdrtghouggvsh X-ME-Proxy: Feedback-ID: i835c46d5:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id BF25436A0459; Thu, 2 May 2024 08:48:57 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-416-g2c1796742e-fm-20240424.001-g2c179674 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <88ea5de8-22ea-4c23-b570-229acd546c10@app.fastmail.com> Date: Thu, 02 May 2024 13:48:36 +0100 To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= Subject: [PHP-DEV] Inconsistencies between parameter number and index when reflecting a method/function Content-Type: multipart/alternative; boundary=81a34ca5fe744d1b90d8af0a5eaf9ef0 From: php@ollie.codes ("Ollie Read") --81a34ca5fe744d1b90d8af0a5eaf9ef0 Content-Type: text/plain Hi All, I've been working on a PR that introduces ReflectionFunctionAbstract::getParameter() and ReflectionFunctionAbstract::hasParameter(), to fall more inline with the other method sets we have, as well as just generally making peoples lives easier. The PR is here: https://github.com/php/php-src/pull/10431 These methods accept an integer to retrieve a parameter by its position, or a string to retrieve by its name. So far, I have built this so that if you required the first parameter, it's parameter 0. I treat it this way because the only other place where we deal with parameter indexes, is ReflectionFunctionAbstract::getParameters() which returns the parameters zero-indexed. The question that is holding this PR back is should these methods be 1 indexed, so that the provided position is consistent with the error messages, or how a person would typically count, or should they be 0 indexed to remain consistent with the existing API. Girgias has asked that I pause the PR until we can have a discussion on this mailing list about how to approach it, so I'm looking for feedback on this. --- Best Regards, *Ollie Read* --81a34ca5fe744d1b90d8af0a5eaf9ef0 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
Hi All,

I've been working on a PR that introduces Ref= lectionFunctionAbstract::getParameter() and ReflectionFunctionAbstract::= hasParameter(), to fall more inline with the other method sets we have, = as well as just generally making peoples lives easier.
These methods accept an integer to retrieve a parameter by = its position, or a string to retrieve by its name. So far, I have built = this so that if you required the first parameter, it's parameter 0. I tr= eat it this way because the only other place where we deal with paramete= r indexes, is ReflectionFunctionAbstract::getParameters() which returns = the parameters zero-indexed.

The question t= hat is holding this PR back is should these methods be 1 indexed, so tha= t the provided position is consistent with the error messages, or how a = person would typically count, or should they be 0 indexed to remain cons= istent with the existing API.

Girgias has a= sked that I pause the PR until we can have a discussion on this mailing = list about how to approach it, so I'm looking for feedback on this.
<= /div>

---
Best Regards,
Ollie Read

--81a34ca5fe744d1b90d8af0a5eaf9ef0--