Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95352 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15169 invoked from network); 21 Aug 2016 19:43:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2016 19:43:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:36271] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/D6-50790-5740AB75 for ; Sun, 21 Aug 2016 15:43:50 -0400 Received: by mail-wm0-f47.google.com with SMTP id q128so95240285wma.1 for ; Sun, 21 Aug 2016 12:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gNwE3sFteThH/XXqPlUzHrpPpoCCvrZRuJC77yEfKKU=; b=uv1LToGNU2OhBurcjZFOFVjckk3AHa6TigB8fryQkfJHABheudDXuTbzIl/D/ClUhH 24MPgEzkxsV3UffGK4sveMVpp5mRsL1mEtg5P1YCEp1gKPQXRNyak7Bactii4Be25JIe ksmK0TvZnrVI8rdAwiJ28CJIbbVTrobc1isce0GrXDAOKR5QQX08rymbTNunsdrVXzA2 5q+rXs2lFok+pcRLbbf8PXdZL9gDAf3U2w95Cq3r5XVpkhFdy8TwzdFR9GgIzl7OlAHm eEZ1LwRdKe+nomCUsRRi9rakwNfUlXSsfZJ2wYAosI0H3Ijo78pn36sb4mY/Xo6iSgUE RSNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gNwE3sFteThH/XXqPlUzHrpPpoCCvrZRuJC77yEfKKU=; b=hxrzhJSBJXyZsOLRQva1IYkL8mRA4+hkwRhtA4cqGtLpGQpEbgwKeMA2/mazOIfdpr fDV+OEZkiEMtMDmy2aiPpnsc/FbDNonmW3Ckp//R9Kx9iuBBWaX0KH0V36iBQTcZSma8 ZYrY7432PZXX5zJAcCID/ixykP5BOSV5hsIuEgjwiTTAfsNyWduAsU8gRRG9X4me9Ah8 OHFClJ3boIksfEuoLZOehAx0+kWJEYjpq0ylMR7bGugPCQ1XPH3/3xUYCcNxfJsTIQoI eeeEGlpCc1Bi2NkaGocXvdufxrOfzUFi7senV+h/GBHclfP5VjFV1UPZ5VWmTBHdjBy3 bhzQ== X-Gm-Message-State: AEkoouscha+V4qea5KuERBN20HzDVcTgK6hNr51KtUW8Xo2wrMOzvpOvJZSfj2Pyew6f/l18XIh98LU/OfP1zQ== X-Received: by 10.194.190.232 with SMTP id gt8mr15647772wjc.141.1471808626954; Sun, 21 Aug 2016 12:43:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.125.242 with HTTP; Sun, 21 Aug 2016 12:43:25 -0700 (PDT) In-Reply-To: References: <0668D584-EE51-4932-85D7-01D8BF70E409@trowski.com> <15E198DD-FF66-475D-ABBC-54ECD2B6BF62@trowski.com> Date: Sun, 21 Aug 2016 21:43:25 +0200 Message-ID: To: Dan Ackroyd Cc: Levi Morrison , Aaron Piotrowski , internals , Stanislav Malyshev Content-Type: multipart/alternative; boundary=047d7b87465e6319f9053a9a2645 Subject: Re: [PHP-DEV] ReflectionType::__toString() prepending \ to class names From: ocramius@gmail.com (Marco Pivetta) --047d7b87465e6319f9053a9a2645 Content-Type: text/plain; charset=UTF-8 Hi Dan, On Sun, Aug 21, 2016 at 8:55 PM, Dan Ackroyd wrote: > On 21 August 2016 at 17:01, Marco Pivetta wrote: > > Yes, but the __toString API is used for codegen, and current code > > generators don't expect a `?` to appear there. > > And they will continue to not have a `?` when reflecting PHP 7.0 code. > Sadly, it won't. Here's an example that shows the BC break in a more explicit way: function foo(Iterator $i = null) {} var_dump((string) (new ReflectionParameter('foo', 0))->getType()); This reports `Iterator` for PHP 7.0.x, `?\Iterator` for 7.1.x. https://3v4l.org/tDkLj > It is only when reflecting 7.1 code, that has a different set of > syntax, that the library will need to be changed to support a new > version of PHP code. > Same as above. The problem is on existing code. > This is exactly the same as userland PHP code parsers. They continue > to work in new versions of PHP, but only when analysing code from > versions they were written to support. They will need to be upgraded > to be able to parse syntax that wasn't present in the version of PHP > that they were initially written for. > > > How many ... failing unit tests does it take to explain a BC break? > > As nullable types are only introduced in PHP 7.1, I strongly suspect > that you won't have any unit tests that would work on PHP 7.0 that > will start failing on PHP 7.1. > > So the answer is 'more than zero' ? > The answer is "one that at least ran the frikken tests". > We don't consider adding new features to be a BC break, as any code > analyser or thing that uses reflection will continue to work, when > they are given code from a version they were designed to support. > New features: OK. We all agree that `void` and `?Foo` need adaptations in userland libs. I wrote it before, and specifically wrote "New features => new codegen/changes, this is normal/understood/accepted." The issue here is around changes that affect old features (__toString), where the behavior changes depending on whether a parameter is defaulted or not (also a previously existing feature) Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --047d7b87465e6319f9053a9a2645--