Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24825 invoked from network); 19 Dec 2017 11:38:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2017 11:38:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 74.125.82.48 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 74.125.82.48 mail-wm0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:46812] helo=mail-wm0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/D1-10479-12AF83A5 for ; Tue, 19 Dec 2017 06:38:09 -0500 Received: by mail-wm0-f48.google.com with SMTP id r78so3011394wme.5 for ; Tue, 19 Dec 2017 03:38:09 -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=TO/xduqXituFZsP0P+hA1Nz6oZgS8c760suMulsRMzk=; b=a+5WxarhaLFO04lXKdP1yx+VhpjYMjmbxKGvT9dOV72wQjMBKOY8SoPJexQ946z2mx MmDnT0hO8L8iXDiMcaQmchJo0TFAy4npddhWt3UyUFZLHy9uoGd0Yl/epGnp3V4mrNAv +AimrjwBzkwH1PHD7dZ3YqGnP9cxnefL4WHdCzfAB5ocfUttWozD5nOx10ssuxgMGoff RG7mQRj7fHLomEd3/OLgd2DC3jB4BKox3sNrWwTBVSr4RUAvj9ouRo60x+JKOAvwdzgV 1IHarFp+q+4iN3gZLqI1TQ49qJQsKhNdMcnjosRBRQXHyi8kNjc1M7hjEJdlcf/xpDd3 5feg== 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=TO/xduqXituFZsP0P+hA1Nz6oZgS8c760suMulsRMzk=; b=K1T5C9Eu8T/w5T59pzIQHuaOVZPscJ/iqUTiH62ZDtxXm/Idp0wS3DxkA3gA1RVjtF KkmLRCz65sGnke1AtEDbKeFsNpF/81FXTQPnE1QbSZwD6i7Oq5FnICzS8VnLSwODqh+q td8qn0LDZZBjwFRF9etaAS6nKbeXDWLbxiv8WeXqZZyOTHnAVgTNHbyJuVn+sjMU+/Qd x7NbUIdmuAunUkdTZZXvfqScksDiu7nZQdN9rBcDJtO/qAIrheERHOXjxHj4xRCDh24s wMBdUmd00ZwZSju+5707W59EG5gz1bQnzCVVlDxbCfsHCxZX0C3IKXC3kYhlaJN8Hjqv j4IQ== X-Gm-Message-State: AKGB3mLfp1jEkKDS6sznNhnZsq5VmglY4ORpHhMHtKzn7QOU66DlVG9P ls+HuNb4PY3VDbPTPLRcTDH3T3GE X-Google-Smtp-Source: ACJfBovUw0EaxmF9khIqVw0FIVGZDl2aJzbI3/2drigA8P25FdLCN/VyuuxKLE9/deBRrQtPi/o9Aw== X-Received: by 10.80.244.132 with SMTP id s4mr145696edm.294.1513683485888; Tue, 19 Dec 2017 03:38:05 -0800 (PST) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com. [74.125.82.49]) by smtp.googlemail.com with ESMTPSA id a16sm13033952edd.19.2017.12.19.03.38.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 03:38:05 -0800 (PST) Received: by mail-wm0-f49.google.com with SMTP id f206so2959680wmf.5 for ; Tue, 19 Dec 2017 03:38:04 -0800 (PST) X-Received: by 10.25.141.74 with SMTP id p71mr2065064lfd.10.1513683484509; Tue, 19 Dec 2017 03:38:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.170.16 with HTTP; Tue, 19 Dec 2017 03:37:43 -0800 (PST) In-Reply-To: References: <3a8054fd-b99f-771f-1f6c-29cf198acdeb@phpgangsta.de> Date: Tue, 19 Dec 2017 12:37:43 +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) Perhaps this is the same reason why we add "public" keyword, even though a member is implicitly public by default. On 19 December 2017 at 12:34, Andreas Hennings wrote: > 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 >>