On 12/19/2017 7:32 AM, Stanislav Malyshev wrote:
> I'm not sure what's the point of it. "mixed" means "any type". Not
> writing a type means "any type". So why waste space and add something
> that contributes nothing when everybody is already using the current
> convention and the new one does not add anything at all?
> 

I agree with Stanislav here, there is no point in adding this type
constraint. Documenting mixed with PhpDoc was required in the past
because it was not possible for documentation tools to distinguish
between `@param string` and `@param mixed` because there was absolutely
no type information available. This has change today, you can ensure
that the tools understand your types.

What is really needed are `scalar`, `number`, union types, intersection
types, and all that together with generics.

Note that the situation would be different if our super type (which is
`mixed`) would allow for some common action, e.g. `equals`. That is not
the case, hence, there is no point in constraining it. Both the super
and bottom type (`void`) in PHP are totally behaviorless.

-- 
Richard "Fleshgrinder" Fussenegger

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to