Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58305 invoked from network); 20 Sep 2017 16:54:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2017 16:54:22 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Received: from [82.113.146.227] ([82.113.146.227:38014] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/48-62331-E3D92C95 for ; Wed, 20 Sep 2017 12:54:22 -0400 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 4A31A10C78A; Wed, 20 Sep 2017 17:54:19 +0100 (BST) Date: Wed, 20 Sep 2017 17:54:19 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: "Christoph M. Becker" cc: PHP internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1332257692-1505926459=:21802" Subject: Re: [PHP-DEV] Confusing type mismatch error messages From: derick@php.net (Derick Rethans) --8323329-1332257692-1505926459=:21802 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 20 Sep 2017, Christoph M. Becker wrote: > Hi everybody! >=20 > If a type declaration inadvertently uses `boolean` or `integer` (instead > of `bool` and `int`, respectively), the error message is rather confusing= : >=20 > [=E2=80=A6] must be an instance of boolean, boolean given, [=E2=80=A6] >=20 > This issue has been filed as , and Adam > submitted to fix that, but > David hinted at the potential BC break, and Joe closed the PR later > stating that such change would require an RFC. >=20 > In my opinion, it would be sufficient to change the error message so > that the canonical name of the type would be used, i.e. `bool` and > `int`, respectively, so the message above would read: >=20 > [=E2=80=A6] must be an instance of boolean, bool given, [=E2=80=A6] Or why not: [=E2=80=A6] must be an instance of class boolean, boolean given, [=E2=80=A6= ] but I guess we then need to also use "trait" or "interface" as words=20 there too. cheers, Derick --8323329-1332257692-1505926459=:21802--