Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123264 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 B8A601A009C for ; Fri, 3 May 2024 15:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1714751275; bh=mW8Pvuw6ykw+Md64DoUxZXl7XE2CO2oH8+Tpwq17uvQ=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=YKrkopq8o/gUv/76836pkAg0nUQJWQTn+xbCL4dGGwoXRDLKMTp7VRnkR9dnG7ygV +mynOVlQZDbKat/sTu2sbe8lVdiCWgvBaAs8thsuJMddvP2Yq9PQUUMLPfUIDd2sq7 90p4gM5C2sn8/9u6EpZv0mNurJjjMWfgNuVu/RlvaWerE/dYLoTx4Ux1cT6CNURHI5 APbisMo4e9ZZIT4JwhoMEx1OUAQY52Wrxa8zyJhdC8+0Al5v6gx0eTxUBx1hCuAADf i1L2gBhU1sXRtGo8f8RieM7CSadvhFx30bgcGu7tGGU6UBntNCw4ffJh39nQW1y0/n pf+32YvvF/UFw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4777D18005D for ; Fri, 3 May 2024 15:47:53 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_PASS, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Fri, 3 May 2024 15:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1714751226; bh=mW8Pvuw6ykw+Md64DoUxZXl7XE2CO2oH8+Tpwq17uvQ=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=ZL/efB0xJFSLhl0UcXMTwM2WpgJzMY3v10cTB7hvob9TUXBiQ1KKUjwzWnnSyWnCl uPvGMisGepjX+X8jlh7KKdlD20vNCBZL0P32bOX0JlCuncoKdrNXpvGelIIVzSWewx T+qoOkyMIM89OB2iRjYONZdVHdkStVx47wEQ2lxZgpwV3WAbxfsUm8qIn0HIfR/kDG wOLVNvCkiZA8kvDEu1dCdbk6XapxRjDtn7mSFAhYS4rl8BoUM7NdCzju7KnbqBf7I/ tvci/YndJVk5g50Kd+JstF+hoVp7PcTg8Kh4BIRH6syvecWIqFzK5RJtiSnMODGvAj ipmfAgi9yRqng== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 3F6B010C4AA; Fri, 03 May 2024 16:47:06 +0100 (BST) Date: Fri, 3 May 2024 16:47:06 +0100 (BST) To: "Gina P. Banyard" cc: internals@lists.php.net Subject: Re: [PHP-DEV] Inconsistencies between parameter number and index when reflecting a method/function In-Reply-To: <63GXg3pF4DIRrXn-zuvO46emeZTrmkMOuiLUFwDA18PdV0y8BNqFvwidOxktGf3Z8geBiwCksbQ-Jpzg9OaxPv6VxDJRDkWCE5S2kabhmF4=@gpb.moe> Message-ID: <5b7ac8bb-6f88-a7e2-ac7e-f57b0970a5ba@php.net> References: <88ea5de8-22ea-4c23-b570-229acd546c10@app.fastmail.com> <28215C90-191D-4159-9C47-86D03B9A683D@php.net> <63GXg3pF4DIRrXn-zuvO46emeZTrmkMOuiLUFwDA18PdV0y8BNqFvwidOxktGf3Z8geBiwCksbQ-Jpzg9OaxPv6VxDJRDkWCE5S2kabhmF4=@gpb.moe> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII From: derick@php.net (Derick Rethans) On Fri, 3 May 2024, Gina P. Banyard wrote: > 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: > > > > > 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. > > > > 0-indexed, as that's what PHP does everywhere else. > > Well not really, if you have an error (TypeError or ValueError) which > indicate what parameter is the problem, it will be 1-indexed. Which *API* in PHP is 1-indexed? cheers, Derick