Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101380 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23459 invoked from network); 19 Dec 2017 11:34:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2017 11:34:46 -0000 Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 74.125.82.44 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:36900] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/81-10479-359F83A5 for ; Tue, 19 Dec 2017 06:34:44 -0500 Received: by mail-wm0-f44.google.com with SMTP id f140so2966036wmd.2 for ; Tue, 19 Dec 2017 03:34:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nU8jNWGqAhYpqd4oAPGOx+AcyIs0eOst1Hcqr6vhtyg=; b=hXQkojRGIPc+hsFpRiDCqSvHkLsZ97Mq+P5GJTHCVtTMDCPyHU50APUsHJgU3DTsr/ laCAUOddwr2NvxgcXXah9g39y5Cbkzs6146eYzeN/36D7CzHY5/WHi9GbcJSj6m1eepK ARGVnfBAZ80AI9Dzo8duyJTdbdN/xiwcvyS6uG8dIAJlIkf2LS2fqofnBKLPLcrY2zIe bLc519uehR2G/qrB6gXpPc5B2v14Ja1oGB+zfSyXV5ytNzW9qT3fmGc7zeo0bQj/I3RR Y/LF9CbtADwAL66zSN+rdAArYDClwLyObPa3V2xkawul+5BV6c4Lm/E9pVOf8vz/0Vrm KRng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nU8jNWGqAhYpqd4oAPGOx+AcyIs0eOst1Hcqr6vhtyg=; b=MGhQAsbzL/Uvj+oPUOnocn3DXybCM1XWfwQ6p0SejFi7hv6pecm8Yb4SaDczmrs2mS kwCrDEUsy2C6kDyzvAWzQ+gha06faZ3yNj4h4WrvMCHJxJTI+rBEPdeBnX6PfEFNKAXT f/WmNSS7w+jCEvhjg5qoVWfi0w6B6ZR+sABSKxOb3RZu8s7098cj2nM45xGVcFu9K5kO BEj7ARCJRsj2joC91zvB4nrNjmGrRyUmXxqebtQo9A0kmH28nx9HMuJ21yIBlP7U9tXO +4xMdczUEip5wisv+JUMW5uopXIR/dR6y/cduGCLZc29ts6Ti6T0mvmDiL6a0N9P6zjf tHGw== X-Gm-Message-State: AKGB3mJiSVUEVbvIiJfXfIPWQuoSlsXlQaVa+kNdbbWl8+tyYPA4+OoE Gqyq54lvQk9yTEgcFppy00NF0Xhc X-Google-Smtp-Source: ACJfBotI5pOfZ/CQduzQ8A5Cb/ytixeuedH2kSuREw6ekIFpLfZU6D0Wcl6WTmBxdG+6Lygdk75xcA== X-Received: by 10.80.146.207 with SMTP id l15mr144650eda.194.1513683280488; Tue, 19 Dec 2017 03:34:40 -0800 (PST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com. [74.125.82.41]) by smtp.googlemail.com with ESMTPSA id r4sm12638018edd.2.2017.12.19.03.34.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 03:34:39 -0800 (PST) Received: by mail-wm0-f41.google.com with SMTP id f140so2965844wmd.2 for ; Tue, 19 Dec 2017 03:34:39 -0800 (PST) X-Received: by 10.25.29.80 with SMTP id d77mr1977257lfd.39.1513683279174; Tue, 19 Dec 2017 03:34:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.170.16 with HTTP; Tue, 19 Dec 2017 03:34:18 -0800 (PST) In-Reply-To: <3a8054fd-b99f-771f-1f6c-29cf198acdeb@phpgangsta.de> References: <3a8054fd-b99f-771f-1f6c-29cf198acdeb@phpgangsta.de> Date: Tue, 19 Dec 2017 12:34:18 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Michael Kliewe Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Mixed Typehint From: andreas@dqxtech.net (Andreas Hennings) I agree with Michael Kliewe. When looking at code, I want to distinguish between: - Developer forgot to add a type hint, or it was left out for legacy / BC reasons. - The function can really return various types, at least too many for any more specific type hint. On 19 December 2017 at 04:57, lists@rhsoft.net wrote: > no, mixed is used in phpdoc comments to say "no type specified at all" when a param accepts anything and in case of "@return mixed" that it can return void, array, int..... I think "mixed" should not include "void". A well-written method/function either has a return value or not. It it is type-hinted as "mixed", then we should expect it to have a return value. On 19 December 2017 at 08:06, Fleshgrinder wrote: > What is really needed are `scalar`, `number`, union types, intersection > types, and all that together with generics. I would like to see those too, but they are not mutually exclusive with "mixed" and should rather be discussed separately. On 19 December 2017 at 11:01, Michael Kliewe wrote: > Am 19.12.2017 um 07:32 schrieb Stanislav Malyshev: >> >>> I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: >>> https://wiki.php.net/rfc/mixed-typehint >>> >>> The purpose of this RFC is to introduce "mixed" typehint on language level >>> to be used >>> as a valid typehint. PHP currently forces users to not use any type in case >>> the >>> type is mixed/unclear. This makes code inconsistent and less explicit. With >> 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? > A "mixed" type hint says that it's really "mixed", and the developer who > wrote that code did not forget to add a type hint. > If you see a place where a type hint is missing, you don't know if it's > mixed, or the developer/you missed to write the correct type hint. > > That's the benefit I see. I would explicitly write "mixed" everywhere in > a fully type-hinted codebase, to eliminate this thought while reading: > Is it really mixed, or was this place overseen and it's not mixed, but > something else... > Because it's optional, nobody is hurt, but some people (like me) could > add this explicit information. > > Michael > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >