Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114081 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43822 invoked from network); 20 Apr 2021 09:42:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Apr 2021 09:42:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 604041804BD for ; Tue, 20 Apr 2021 02:45:07 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 20 Apr 2021 02:45:06 -0700 (PDT) Received: by mail-pf1-f169.google.com with SMTP id m11so25168076pfc.11 for ; Tue, 20 Apr 2021 02:45:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SIc3f/XKDbTDzJSsl/EoRAZjGpacGnU0xz6gYl0Iwu4=; b=l826lop3DbnMK8MM6E2R/BPn0qLrayz9pqcgnUDcDf/T9nu4m9+5jijELatJ+MeHqJ pyKlwDo8KrgE14w1PqeSImEXOnApKujJDxbjkXxiA+v0VITI/EUcNpb0GoUB7sA0ONHc 7fm//IABB9ocVZf/eUbgWULkhuyOTKHUpReuIpwIVIlqj/KHgrZMiGyn31u1ELMd1bzI oG1qH9OHdKERnadbJUI4bsbxuIBZvsfWS4x3Gj704ZY6igNmxfe5l2S2xcMV4281LTFk unzAOaIR9wYgYe/jQha6S0RtLT9Hyw1z176J6K7CdtZcZp1mCcDZO98ubG98l8BRBXLA 9Elg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SIc3f/XKDbTDzJSsl/EoRAZjGpacGnU0xz6gYl0Iwu4=; b=OeDBW70U2/XQh9dz5xsHysjJNLg5rq3IDuCLMBzjGBTwYxKXNCFQNNKnw5FCza+nrS sRZDzhwU06Umczcqn6nKcUQ9E8WWG6p23RzS+IjGwqNeFEjWxCjgwxNonMOGt8qbiEM6 mmApxQZjWcHBfgwvSawGjc7NG61e5vGRsWo73HyRQO9oXEdTCfsJ1jxLoSlyPSMnU7qK BGvU2+GWtAR/ARsbCC0GevBOjOUod1aftpwwJaQpT/74dhKxF1k0RfSHjIW+sUoq9R+4 o6Zv8v7I+b1mPrUT4AHUK591gFXLs2m0/znoxMhtUZKQzuE8oTGSj9a1u2jzyqzoAlSz 669w== X-Gm-Message-State: AOAM5302mcO2Dezb0hv8ewLbPMMPoqXZmIdKwzas31HzKDZK+eItQHnn uoTe2Bh9vrKU7eR5+AvuFTPn6gQAXz6DJpIptuCN0TIU6D9EjeEI X-Google-Smtp-Source: ABdhPJwVGAQR/hViKYJVMAb4ktyC6r5DJXIP9NBkWgobz2f5n/VHt3LT1A/M0vKWFgBpSf+NuxmSQPHG68ChXt8ReHk= X-Received: by 2002:a63:1b10:: with SMTP id b16mr15849227pgb.308.1618911905762; Tue, 20 Apr 2021 02:45:05 -0700 (PDT) MIME-Version: 1.0 References: <918bd585-0a5a-063d-7d4e-c89eadef0dde@processus.org> In-Reply-To: <918bd585-0a5a-063d-7d4e-c89eadef0dde@processus.org> Date: Tue, 20 Apr 2021 11:44:54 +0200 Message-ID: To: Pierre Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000010d1e805c0644d5b" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding return types to internal methods From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --00000000000010d1e805c0644d5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Pierre, Having type-inference wouldn't transparently fix some of these issues ? > > Let's consider a method such as foo($array) which returns a bool or a > string, for example. And suddenly, the types get specified as foo(?array > $array): bool|string. > PHP doesn't have such an advanced type inference capability: just consider dynamic calls, or regular function invocations where the return type information is not available. On the other hand, we could add return types implicitly, as it was proposed earlier, but I didn't really like this solution. For a little more details, have a look at my initial message: https://externals.io/message/112625#112625 Besides, I think it's better to document the return types explicitly as a declaration, since they usually help during implementation. M=C3=A1t=C3=A9 --00000000000010d1e805c0644d5b--