Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102853 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4523 invoked from network); 16 Jul 2018 15:42:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 15:42:19 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:37288] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/0D-39793-9DCBC4B5 for ; Mon, 16 Jul 2018 11:42:18 -0400 Received: by mail-wm0-f42.google.com with SMTP id n17-v6so16403942wmh.2 for ; Mon, 16 Jul 2018 08:42:17 -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=wdCV3kQtmQkHU1xyhme7u3HDkGOfHFzssVgpMwfvkaY=; b=qawVwCUhQeug2/2SHpZ4mMotCLpPk6/wwxKuBH37rsZv5PYZKxADilEuH1mETrhfFV mO9gx+UsQ/wknHqoJI/pbGJ9TLs1GbIKBW057uzXPqyfN7phy5V53qABVkmWEaCvJgo1 sBvXPoavj4XgZVYbtH06gmIIwd5s2r57omS+oEAewpScAEyjM/oA2NsjI7QKW6A+uys9 owR/GCAXE1RCNnvcWQPB6sOi2KMrhJVb0igXDzFnnqdjJ0udGzSei5GkldMGM7lrO1aQ f5VdB97+0LakES0gvhQhyzG8fHQO+yTzz3Zve0we9GOsQPeH3uZGqz28lsZT4XFBDLDS 5h4g== 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=wdCV3kQtmQkHU1xyhme7u3HDkGOfHFzssVgpMwfvkaY=; b=OHX6gbkdJNxjsl2ROlhX0eM/aekzFw4+K7uCqkkwnsSgL0ZUVemJYUbNXA+oJEHqRt 3ciFBNcKzj0MBoHGKPmb63NyU1R1s7Ted3HeHHFk6jaX6zRzLddMUQkcQUD+MVTuquvC kqzcGIIKGX5MRFHUU3rX7H5m3noQ2+c3vu8KPIAoWufoi9onax8zHO0gEILvAwDGMw/r OJ3BvCo3DEi1XIuMjKtuMPBJijr4OQ5FoeYSaINnkCVH2ok0h0vZoe0Rdqi9mKYDAbqm 371+5+naCJ7RzZxyDUsHaNRe0HIPyOJiPFSLgLHVgfvuU5nAj7Y9wFRzO/uGmQL1FD2Q dU5g== X-Gm-Message-State: AOUpUlHzYQijMVnnhWsHtBzwp5LcC3emA9O1SKO0w9ScnhiNWNEdBxY7 7vLIMw6/s18o/hCLm3v/safG6BF9whM7AD1Sd98= X-Google-Smtp-Source: AAOMgpeKTjOqxnkbkhGRHAIguDEGMJXJvAXrDkfIyJFV3j5oCg0gj3qo3E3uZc5v4IVv4QwY6wjAmac1UvkKrAgc1KA= X-Received: by 2002:a1c:ac42:: with SMTP id v63-v6mr2393986wme.92.1531755735214; Mon, 16 Jul 2018 08:42:15 -0700 (PDT) MIME-Version: 1.0 References: <8916EC21-D368-40F8-9ABD-CE0C04A73539@gmail.com> <0AA3251E-A0D8-492E-AEAC-3B2FBBFDB944@gmail.com> In-Reply-To: Date: Mon, 16 Jul 2018 17:42:04 +0200 Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000007aef2105711fac47" Subject: Re: [PHP-DEV] Non-nullable properties From: ocramius@gmail.com (Marco Pivetta) --0000000000007aef2105711fac47 Content-Type: text/plain; charset="UTF-8" There are naturally 3 states in the engine: 1 - value set 2 - value not set (default `null`) 2 - undefined/uninitialised These have been around since 5.0 AFAIK. On Mon, 16 Jul 2018, 16:55 Rowan Collins, wrote: > On 16 July 2018 at 14:28, Marco Pivetta wrote: > > > These don't really need explicit tests in most cases, but rather static > > analysis (currently happening via docblocks). Static analysis tools like > > vimeo/psalm already pick this up. > > > > > Then why do we need the type hints at all? > > > > > > I'd even be happy to get type hints that only have effect on > > `ReflectionProperty#getType()` as a massive improvement over the current > > situation we've monkey-patched us into, but the patch is indeed > consistent > > with PHP's current state. > > > > > I disagree that it's consistent. It introduces an entirely new kind of null > reference ("declared but uninitialised"), which will require *more* careful > checks than forcing the value to be initially null, and will undoubtedly > further annoy those who already claim that isset() is broken (the RFC > doesn't even mention it, but I presume uninitialised properties will return > false from isset(), but throw an error from is_null()). > > If all typed properties require a valid default value, the patch is > simpler, errors are raised at a line where you can fix them, and the > language remains consistent - if you're promised a Foo, you get a Foo, not > a "whoops, why isn't there a Foo here?" error. > > > Regards, > -- > Rowan Collins > [IMSoP] > --0000000000007aef2105711fac47--