On Sat, Dec 19, 2020 at 8:27 PM Rowan Tommins <rowan.coll...@gmail.com> wrote:
> On 19/12/2020 11:28, Benjamin Eberlei wrote: > > This is my take on parameter names now being public API, at its future > > potential for code maintenance, refactoring and backwards compatibility. > > > > https://wiki.php.net/rfc/named_parameter_alias_attribute > > > Hi Benjamin, > > This sounds like a sensible feature. The suggested name seems a bit > long, but I'm not quite sure what to replace it with. > > It just occurred to me that there's a potential connection, in concept > if not implementation, with the #[Deprecated] RFC you also just posted: > parameter name aliases may well be used to provide a limited-time > transition mechanism rather than a permanent feature, so it might be > useful to allow them to be marked as deprecated. > > e.g. > > // Version 1.0: parameter name is misspelled > function doSomething(bool $formatNumters) { ... } > > // Version 1.1: parameter name changed, old name added as a deprecated > alias > // if the misspelled name is used, an E_DEPRECATED is raised > function doSomething(#[ParameterNameAlias('formatNumters', deprecated: > true)] $formatNumbers) { ... } > > // Version 2.0: alias removed; the misspelled name is now an error > function doSomething(#[ParameterNameAlias($formatNumbers) { ... } > Oh that is a great idea! It makes sense to allow developers to mark the alias as the deprecated parameter name. I will add this to the RFC on my next iteration. > > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >