Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102492 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4798 invoked from network); 27 Jun 2018 15:46:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2018 15:46:17 -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.208.43 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.208.43 mail-ed1-f43.google.com Received: from [209.85.208.43] ([209.85.208.43:39265] helo=mail-ed1-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E9/EE-01794-641B33B5 for ; Wed, 27 Jun 2018 11:46:16 -0400 Received: by mail-ed1-f43.google.com with SMTP id w14-v6so3372680eds.6 for ; Wed, 27 Jun 2018 08:46:14 -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 :cc; bh=vW15Vr4IJQPgcsjN+uEXM6OgtE0DlmJO977qTXn1iAs=; b=Oiul2C7lyAbdtVgE1LTWbccEmcPgPvl6oSie5f0B/LFvOqnzmXvgJJoVdxFnJvJm2A ijSBw8PFBNoouPj9W2XurO2nedA5GnrKr8xYm1BRa/p43LpiRHhZ/36DGkciQ2+noSsn b5HStBa8ecCnZdI+L/vWIdnV/LayFD7btlBZcGD45K2mSAFHM7EJEtvYteGZYKuytJq8 bqE1DQbpVrq2zw6Jny0ZO8e4jjhP8rJWeprkBw/0KSLSBHsuwtvAK4E8onMAHT5jpP6B odCpBcZ/5S2b6UHb++hZZhu0ZySU5NRfO2yDJYHtqrjmWKzQY7Iu2/vYeGudECxUXEZQ W+sQ== 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:cc; bh=vW15Vr4IJQPgcsjN+uEXM6OgtE0DlmJO977qTXn1iAs=; b=Su+gBYQWKt7YPbFalY4RTRtnGo7kpO+qviGiqJAw9Bn6urk8jCd0mORskxH2BrtZCI N4PSzhmeWcOufk/MxPr6XhHFc0V+FLn+p+cq2g760QQARdN1QC7AB7QiyJVghQDdHKlQ W9rX+DtH1Z16QtyvE/K9n3FNpETab6jq6St28jWTVZ0cL5F3qOVIoVVp382jT2JQXGtS 11oMo8FWX4t7GzB8s+pyWUy7nt44rO7WRFEcpwTCbMSxHPkyGOD4JzaV/O5NAGVHvqSr llnEirm3dSJRfA2dia1EIJlCrWy5Ey8XqwP+uR8bRyvMybNHb4IMxeNxhf+hMrpEJ1zf S8OQ== X-Gm-Message-State: APt69E0nEGsEfJ/M4NoEzsBa96yyOkpdm/x0ZkvmHElJffZEQ5cBRJjK dMyU+DAciZ5jbD4wnbhUzM2rogFMWtTzMi79CSE= X-Google-Smtp-Source: AAOMgpcK3nkGj0omqMKm744cPShNOp+hEAcTdR/04EkUZJH+xCx1xawOlhGqdsJmNcJHHxDb+HSpg21ZqyGT7LeZ1T0= X-Received: by 2002:a50:95f0:: with SMTP id x45-v6mr6060637eda.99.1530114372086; Wed, 27 Jun 2018 08:46:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8863:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 08:46:11 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Jun 2018 16:46:11 +0100 Message-ID: To: =?UTF-8?Q?Micha=C5=82_Brzuchalski?= Cc: rudolf.theunissen@gmail.com, Wes , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000009d30f9056fa183ed" Subject: Re: [PHP-DEV] [RFC] User-defined object comparison From: rowan.collins@gmail.com (Rowan Collins) --0000000000009d30f9056fa183ed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 27 June 2018 at 16:24, Micha=C5=82 Brzuchalski = wrote: > There is also one more thing I can think of. If __equals and __compareTo > methods > don't have any restrictions for $other parameter typehint then I'll be ab= le > to declare > Foo { > public function __compareTo(int $other): int {} > } > and will get some error on > new Foo() =3D=3D new DateTime('now'); > This can already happen with other magic methods. For instance: class A { public function __set(int $foo, int $bar) {} } $a =3D new A; $a->test =3D 42; # TypeError: Argument 1 passed to A::__set() must be of the type int, string given As long as the implementation correctly unwinds the stack when a Throwable is encountered (__toString *can't* cope with this, and bails out the engine), I don't think this is a problem. Regards, --=20 Rowan Collins [IMSoP] --0000000000009d30f9056fa183ed--