Re: Inconsistencies between parameter n umber and index when reflecting a method/function

From: Date: Thu, 02 May 2024 20:33:33 +0000
Subject: Re: Inconsistencies between parameter n umber and index when reflecting a method/function
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-123255@lists.php.net to get a copy of this message
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. cheers Derick

« previous php.internals (#123255) next »