Re: [RFC] [DISCUSSION] Scalar Pseudo-type
| From: | Niklas Keller | Date: | Tue, 26 Dec 2017 15:36:54 +0000 |
| Subject: | Re: [RFC] [DISCUSSION] Scalar Pseudo-type | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101417@lists.php.net to get a copy of this message | ||
>
> Am 24.12.2017 um 15:34 schrieb Fleshgrinder:
> > I prepared a PR to add the
scalar pseudo-type to PHP after
> > the
> > discussions around adding a mixed pseudo-type. I strongly
> > believe that
> > it makes sense to provide the most common primitive union types with
> > handy aliases even if we are going to add union types in the future to
> PHP.
>
> Thank you, Richard, for working on this.
>
> I spent a lot of time this year introducing scalar type declarations into
> existing code bases. In quite a few cases I was not able to do so because
> the existing code works with parameters that can be of two or more scalar
> types. With PHP 7.2, I can only document this outside of the code using
> @param annotations (until the code has been refactored to work with only
> one parameter type).
>
> With a "scalar" type declaration I would not have to fall back to @param
> annotations and could express the type in actual syntax.
>
If you want just two of those and not all, you'd still have to use PHPdoc
for those?
IIRC you voted against union types, which would be a better fit in that
case?
Regards, Niklas
>