Re: [RFC] Mixed type
| From: | Paul Jones | Date: | Sat, 30 Jun 2018 20:28:47 +0000 |
| Subject: | Re: [RFC] Mixed type | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102541@lists.php.net to get a copy of this message | ||
> On Jun 30, 2018, at 15:17, Sara Golemon <pollita@php.net> wrote:
>
> I'm not super excited about this RFC because, as you say, this information could be easily
> encoded into the docblock for the function/method.
I would enjoy a 'mixed' typehint for exactly that reason; i.e., that I don't have to
put it in a docblock.
Given this method ...
public foo(string $bar, int $baz) : void { ... }
... I don't need any docblock at all for the params.
But given *this* method ...
public foo(string $bar, int $baz, $dib) : void { ... }
... I find myself wanting (for completeness' sake) to add a docblock indicating the $dib
typehint:
/**
* @param mixed $dib ...
*/
public foo(string $bar, int $baz, $dib) { ... }
... and *then* the docblock looks unusual to me, and I want to fill out all the rest of the params
in the docblock.
Yes, I'm aware that may be idiosyncratic. Even so, being able to do this ....
public foo(string $bar, int $baz, mixed $dib) { ... }
... relieves that bit of docblock dissonance. If it does so for me, I bet it would do so for others.
--
Paul M. Jones
pmjones@pmjones.io
http://paul-m-jones.com
Modernizing Legacy Applications in PHP
https://leanpub.com/mlaphp
Solving the N+1 Problem in PHP
https://leanpub.com/sn1php
--
Paul M. Jones
pmjones@pmjones.io
http://paul-m-jones.com
Modernizing Legacy Applications in PHP
https://leanpub.com/mlaphp
Solving the N+1 Problem in PHP
https://leanpub.com/sn1php