Skip to content

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Apr 28, 2020

number is an alias of int|float, scalar is an alias of bool|int|string|float.

@kocsismate kocsismate added the RFC label Apr 28, 2020
@carusogabriel
Copy link
Contributor

@kocsismate If you want to relate this one with https://bugs.php.net/bug.php?id=67837.

str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ARRAY));
}

if (type_mask == MAY_BE_SCALAR) {
Copy link
Member Author

@kocsismate kocsismate Apr 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not easy to determine whether scalar/number or their union type counterparts should be displayed

@nikic
Copy link
Member

nikic commented Apr 28, 2020

For what it's worth, I'm probably -1 on this one. I think the stubs work showed that these types are actually quite rare. A general type aliasing feature might make sense, but aliasing these two in particular might not be worthwhile anymore.

@kocsismate
Copy link
Member Author

@nikic Interestingly, I see the other way around. :) I don't like general type aliasing, but I think these 2 specific aliases would make sense. Maybe their usage wouldn't be very widespread, but still, they could offer a more expressive alternative to their union type counterparts.

Nevertheless, I'll first try to get to know if there is really interest in this proposal. :)

@moliata
Copy link
Contributor

moliata commented Apr 29, 2020

While I do think that both number and scalar are actually fairly useful type aliases and are used in the PHP documentation itself 1, I do agree with @nikic that general type aliasing might make more sense. When that is in place, we could just make a few default type aliases such as these one.

@kocsismate
Copy link
Member Author

I'm closing this one as I'm not going to pursue an RFC. Mainly because of lack of interest, but also, I'm not sure if reserving the number name is a good idea.

@kocsismate kocsismate closed this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants