Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123257 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 0B9D51A009C for ; Fri, 3 May 2024 00:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1714697195; bh=wA24/SU5fxXz4vRAwNoqZtuxWs4LphhoxO+Sxnu5x0Q=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=azhetAXIXct+QlJpE44eznkv3LR3yd+35gB2RFJtTE3zQUo8FdopPI4ynOyj8smxU c7bCIFS+b3uLeOLRPlwG/aAvZHD/528UHV1xiaVxRIvrKf4Ps50RC6gVcX/rS/wCUf Qr1PYuEU3/uwhOZxWzL0TAKAgPScvqxXzYwhmTDKPB0UV/uTmNuTzknn9Q2DC3SNwH cPtLq9k6ezhcpi1Ehj5dffuPU1ubVsd7jglocdCgozzgSehAzRM1RN0VC9JjphUDcT 2jownxH6mXMN0mjBy7mqfZ+63rGUN4nNvoU54CNFBYRuahGvgDS7txWGWI72aSvMvn WwkCeY/a2FBpw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 56E7E180068 for ; Fri, 3 May 2024 00:46:33 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,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-4018.proton.ch (mail-4018.proton.ch [185.70.40.18]) (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 ; Fri, 3 May 2024 00:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail; t=1714697145; x=1714956345; bh=wA24/SU5fxXz4vRAwNoqZtuxWs4LphhoxO+Sxnu5x0Q=; 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=rrAoFzhtPlPAXIjGdy8v4ifkoSAFtzwSD5XjGVBRLRNMznJ9m5SkU0qtutYvqK8sT IJojoaW9vDmwMwBu5q84vtArcWp1i/DWSJAvc4dDA2XuqhdLj6awxp+FXBsw6xMztw 46lYPzclBSaSVYR9ldPpWTD6ipHL6/8LQx08RiHgaJCPod76lCl7JJWajlhu7fPoO9 IecIDXPIGiVGXMyxnOOWUlG/QzhJK26I5mf8AiI5MgA0yTFYYC3Gu2anpsZK5Xxuh2 5n0WF2zqYpdSLsNGvhMQP+HavvdKJCDTBoaVahkWDw43guXjlYeBbOojx20/FIV6Ld /k41Brgtl8FUQ== Date: Fri, 03 May 2024 00:45:42 +0000 To: Derick Rethans Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Inconsistencies between parameter number and index when reflecting a method/function Message-ID: <63GXg3pF4DIRrXn-zuvO46emeZTrmkMOuiLUFwDA18PdV0y8BNqFvwidOxktGf3Z8geBiwCksbQ-Jpzg9OaxPv6VxDJRDkWCE5S2kabhmF4=@gpb.moe> In-Reply-To: <28215C90-191D-4159-9C47-86D03B9A683D@php.net> References: <88ea5de8-22ea-4c23-b570-229acd546c10@app.fastmail.com> <28215C90-191D-4159-9C47-86D03B9A683D@php.net> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: 9e588c4fabe613bd360b573a935763a3a3ab350f 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 Thursday, 2 May 2024 at 21:33, Derick Rethans wrote: > On 2 May 2024 13:48:36 BST, Ollie Read php@ollie.codes wrote: >=20 > > 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 be= cause the only other place where we deal with parameter indexes, is Reflect= ionFunctionAbstract::getParameters() which returns the parameters zero-inde= xed. > >=20 > > 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 message= s, or how a person would typically count, or should they be 0 indexed to re= main consistent with the existing API. >=20 >=20 > 0-indexed, as that's what PHP does everywhere else. >=20 > cheers > Derick Well not really, if you have an error (TypeError or ValueError) which indic= ate what parameter is the problem, it will be 1-indexed. Which, for me, makes it more logical to have it 1-indexed. If the ReflectionFunctionAbstract::getParameters() API did not exist, this = is what I would have pushed for. Moreover, PHP already has a 1-indexed and 0-indexed discrepancy with the ob= _get_level() and ob_get_status() functions. In the end, I don't really care what we choose, but this just needed clarif= ication from internals on how to proceed. Best regards, Gina P. Banyard