Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106542 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88697 invoked from network); 11 Aug 2019 15:09:54 -0000 Received: from unknown (HELO mail-qt1-f177.google.com) (209.85.160.177) by pb1.pair.com with SMTP; 11 Aug 2019 15:09:54 -0000 Received: by mail-qt1-f177.google.com with SMTP id t12so11701162qtp.9 for ; Sun, 11 Aug 2019 05:37:47 -0700 (PDT) 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=uH1apKh7+KvNC0b2Q3RUdrsUaiXIxYS8wLnWe1Bv1jY=; b=iypOm3/wrEVBlmO7dCoCLhDS7EEGp4hJh5TQjlGA7//6FdKArV1xROz8Yd+BDT4+uD 7AhAAI7GzPGBFbYLURAF/8ue0MwtyN3E0qv/k69SPNJt2oDG1GoVsdO5nyGvcV19g43k B/pMHsphv+zT0/qbA3AR1iKazgIb6EF1NaTpSzlzcq85BTEhleU0Gb1o5hHLUY4oUlcB eVEXYQ0LuT7jvdDKoZqpR8J8LFWZRI3u2VAe1NzIUeDqOlx1pzJAOK64mals7k7JXPlD B3pUSUlVNxJqGcnwPGf0tELX6dV4Q2Baj9/qzBVYZPAKC2dM6mDCdPG+ptcptuhXHrYs 5iJA== X-Gm-Message-State: APjAAAWizfT8ZFyxEbGYUezRlBzO7eHdaa8W5GU21Lu7z92y4MLYOJFC E6i5zb2wNl0pXF+83Ej0TFwjWtoScJuc43NdM2gf/g== X-Google-Smtp-Source: APXvYqzXLc2vaNuKYkGLKmzaPwySQHvdz4WnL8Rj8EtzUENeew/YCbUDI0jcv25MbEn8uUg+JXEx5oLNjcpD/HUnJas= X-Received: by 2002:ac8:45d2:: with SMTP id e18mr851607qto.241.1565527067464; Sun, 11 Aug 2019 05:37:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 11 Aug 2019 07:37:36 -0500 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000be2679058fd6ac8c" Subject: Re: [PHP-DEV] Adding return types to internal methods (PHP 8) From: pollita@php.net (Sara Golemon) --000000000000be2679058fd6ac8c Content-Type: text/plain; charset="UTF-8" On Sun, Aug 11, 2019 at 3:44 AM Nikita Popov wrote: > What do you think about this? As we are currently annotating everything > with types, and we're at a major version, this would be the ideal time to > make this change. But there's certainly a BC break here. (And, for the > record, this is not the type of BC break where P++ or editions help, > without creating a larger mess.) > > I think your original proposal was spot on. It added to the language without creating any BC breaks. The ideal outcome. This modification adds an admittedly small BC break for an equally small benefit. -1 from me. -Sara P.S. - Perhaps a way to the middle might be to introduce implicit return type hints. If a child method is implemented with no return type specified on a parent method which has one, then the parent's type is assumed at bind time, then we provide a better runtime error if that assumption is violated in a strict_types=1 context which is the only place where strict covariance of return types matters to PHP. --000000000000be2679058fd6ac8c--