Re: [RFC] Mixed Typehint

From: Date: Tue, 19 Dec 2017 19:01:25 +0000
Subject: Re: [RFC] Mixed Typehint
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-101389@lists.php.net to get a copy of this message
Am 19.12.2017 um 19:19 schrieb Fleshgrinder:
On 12/19/2017 6:43 PM, Andreas Hennings wrote:
The argument, which I support, is that "mixed" would allow to distinguish against cases of "developer forgot to add a type hint" or "no type hint due to legacy / BC reasons". Also, with a "mixed" type hint, you know it is not "void" (this is still the same argument).
The developer forgot the type constraint if there is no type constraint in: 1. the code 2. the DocBlock This is a simple rule that you can already adopt without any changes to the language. The thing is that mixed is not required at all at the moment PHP supports more sophisticated type constructs. As I said earlier, pursue them, not this. PS: It's interesting how people fail to see the power of union and intersection. This is currently happening on the Kotlin side too. A simple example for a union type was already given: string|int
i see the power and have hundrets of definitions where i would add such hints instead nothing if it would be supported but that's a different thing and both don't collide "It's a simple alias for the current behavior of no type and is fully interchangeable" from this RFC about mixed is completly unrelated to union types

« previous php.internals (#101389) next »