Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102852 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1018 invoked from network); 16 Jul 2018 14:55:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 14:55:35 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-io0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:35702] helo=mail-io0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/AC-39793-6E1BC4B5 for ; Mon, 16 Jul 2018 10:55:35 -0400 Received: by mail-io0-f177.google.com with SMTP id q4-v6so38081631iob.2 for ; Mon, 16 Jul 2018 07:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=3SkzjKGwMS1O4xfaSZ6V1Fx/N/l45ooXp9HxNoAv4oY=; b=gsRaALYgVdJ6AdY8cvPc7nMynFANtHbW5Lvu1k6iSF3dSaq6TR6s/g8GFRrvc/6p2Q 5pOT7agWFTK3bR66varvWHQNcyQEwwXP+2RtG1y5SozLA9OeW4CEt5iSrFspYg2uh6qW 2HciQ8LUyvarMi9l0gUnYQE66R5NKIk9OMTd6vouOMl9wPbSAOxlkDHF291tepr2V3s7 AVU64X+WhlvZ5+Dm9ug5OK6t4e6/RNWQ6Lh8xJCfk/HJ5WyGbOA40phdmCattZN+RCUs +3pLMTpocAEwf8v0IjVaje1oXr2d42XQxgyWYmfm7LGb+JMVE7BbYKL1lUGJ0Z+U7KPA tQ+w== 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; bh=3SkzjKGwMS1O4xfaSZ6V1Fx/N/l45ooXp9HxNoAv4oY=; b=pttNMSU8nxP7PW/NXFJE5zxj2jWAprQKUzUohG/hlPYNZNuWyWSMMHqgZjH2Rt53fz M0Rcya6H4RdEOJeE/D13dpKAU1jGxGq4rBdDTm09Td7aCoxV498URa7WUT8AWQ6yD9zL iW9CpdHK06bN11A/B8P50PHKncQnwBAtpXuhyxIJLG2cmo6+K7rz96eHiWKFtxQo3eZy 8tFvV0EKX05rJkLfLAQFw6H5pHep7hHroJwL2GRu2l4HEdntkrtC+wK8YbVQPoVnRuuu dugne+vE3oC5aBzgaeCFPae0kSnq48/ydB8xy7SVn1CmpF/RybkK+5pEGAGY0CyMjIG0 wiHQ== X-Gm-Message-State: APt69E0s+6X4vNOps8zp7mapvjEPSJQn3j6mzcQ/ymB9ICEhSqHgE1b5 5gYGT7E+OVTDVdBliidkFZPlgwNqoiEGwvm20Uk= X-Google-Smtp-Source: AAOMgpezcmH30KZtQmaEMRBnHjlvVemkqP2/iGFu+rx3VyTzG/mUppEn84YGmUxs63PrET5s6ABJIDZBpcp3esDm9ag= X-Received: by 2002:a6b:dd01:: with SMTP id f1-v6mr39762886ioc.45.1531752932261; Mon, 16 Jul 2018 07:55:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:95a8:0:0:0:0:0 with HTTP; Mon, 16 Jul 2018 07:55:31 -0700 (PDT) In-Reply-To: References: <8916EC21-D368-40F8-9ABD-CE0C04A73539@gmail.com> <0AA3251E-A0D8-492E-AEAC-3B2FBBFDB944@gmail.com> Date: Mon, 16 Jul 2018 15:55:31 +0100 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000069443405711f0560" Subject: Re: [PHP-DEV] Non-nullable properties From: rowan.collins@gmail.com (Rowan Collins) --00000000000069443405711f0560 Content-Type: text/plain; charset="UTF-8" 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] --00000000000069443405711f0560--