Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104245 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70207 invoked from network); 6 Feb 2019 17:05:20 -0000 Received: from unknown (HELO mail-it1-f177.google.com) (209.85.166.177) by pb1.pair.com with SMTP; 6 Feb 2019 17:05:20 -0000 Received: by mail-it1-f177.google.com with SMTP id p197so6530492itp.0 for ; Wed, 06 Feb 2019 05:46:44 -0800 (PST) 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=XoapZRrBoFjrKsuyfVc4V4A2yuX/Xd5+pYu4OKIsSqk=; b=jB23sGS9lK7KLsvxyYYYlQyjhB4Er3Jg7oDG8Amj4o3gyQz5/Dg2fXddKlGdhCkGYz nsRvV3wZauktsvu3tfgREQPKBSjDFj7tk/MumsK7wuyGJYQmvX8SdgfJeE9rMLu5hgcg ImxKzMdNbjBzkQ4FhoMiuLxt/1nKZlS1YZJoTYr9fLQgf4QRxY4C6GpuPCsIZCUD7BRO ahJBKFTJA6czwkM3YQfHXXQXZnF668m5UyDOGZzaSnZqLLj3LU53tWY1mPkVMzbMW1SW n/6tUByoWXtsBxSWGbky0e/f+kfKWg38acOxOTPON/HrSj+W21/9iF1WQqO3kdp6P/E1 mzDg== 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=XoapZRrBoFjrKsuyfVc4V4A2yuX/Xd5+pYu4OKIsSqk=; b=pFPVokdbFZgkWnt3MXkFRcSR33OORZ4fgnrcow8P3E+to0uQXNVCqf+It+duhnAKHP ZRUYxybfkVxMDToNSkg6tAJzp9NwaTj2Jj8QZthFgavPoNhKAMBqav7IENgMiz4OYzGn GPcJnEtQeAZl3vNtUuSavuj834rJ/TpIihl34y/IYSqxtFR4gju6SkhbyrioECQ8Dkcm JlI2lYqH1bvro1cwoyIPUQ5KOk16Yjgc9g2WIqH4QKxNsUnRe+C2Y5I625GbeS6dKkhq liXGva99DoqayslKzs+3qwHrg3foQqbgI7AoQ1qPR0tW6MwUM1wy+yv/9z3iEIPXoQOD fVew== X-Gm-Message-State: AHQUAub8TzmkUrTQgptcvYp+g50N/P5T8RzK2pKNQE2uxX1Mcti1QY2c tCo0reFjfgJ/gAVYXfKvMIDFLG7rCQTKWPApBAc= X-Google-Smtp-Source: AHgI3IaSLqrREtwdWrP6lPg1AgchZhEo4sxj01FHVBbqbtsj86rkQuDAdkvPSRt6XpHLuD+WFyXVBRMiFaiTMPdvzxQ= X-Received: by 2002:a24:d4c2:: with SMTP id x185mr2398790itg.34.1549460803694; Wed, 06 Feb 2019 05:46:43 -0800 (PST) MIME-Version: 1.0 References: <595b374c-bc4f-9b8a-0013-6485abbfb477@php.net> In-Reply-To: Date: Wed, 6 Feb 2019 13:46:32 +0000 Message-ID: To: Benjamin Morel Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000cc3805058139f451" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Typed properties v2 From: rowan.collins@gmail.com (Rowan Collins) --000000000000cc3805058139f451 Content-Type: text/plain; charset="UTF-8" On Wed, 6 Feb 2019 at 12:38, Benjamin Morel wrote: > While playing with typed properties, something that annoys me a lot, in the > context of a data mapper, is not to be able to use isset() to check whether > an object's property is initialized. > This sounds like a reasonable problem to raise... > Would it be possible to introduce another isset() operator, that would > return true for NULL values? > ...but this sounds like the wrong solution. The distinction you need has nothing to do with nulls, it has to do with the very specific case of "this property currently violates its contract and I want to treat that as something other than an error". I personally still think that unset() should raise an error for typed properties, but apparently there are cunning hacks that it makes possible; as such, 99% of PHP developers should never need to detect this state. It therefore makes more sense to me to have this as a specific API relating to typed properties; if it can be done faster outside the reflection class, it could be in the form of a new function like property_is_initialized($object, $propertyName); this would be an extension of property_exists, that handles the edge case of "declared with a type and then explicitly unset". Regards, -- Rowan Collins [IMSoP] --000000000000cc3805058139f451--