Re: Confusing type mismatch error messages

From: Date: Wed, 20 Sep 2017 17:08:07 +0000
Subject: Re: Confusing type mismatch error messages
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-100720@lists.php.net to get a copy of this message
On 20.09.2017 at 18:54, Derick Rethans wrote: > On Wed, 20 Sep 2017, Christoph M. Becker wrote: > >> This issue has been filed as >> <https://bugs.php.net/65656>, and Adam >> submitted <https://github.com/php/php-src/pull/442> >> 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. >> >> 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. ¨¶ >> ½“O^Æ®hÔ=9G¹bool and >> int, respectively, so the message above would read: >> >> […] must be an instance of boolean, bool given, […] > > Or why not: > > […] must be an instance of class boolean, boolean given, […] > > but I guess we then need to also use "trait" or "interface" as words > there too. That has been suggested by Adam, but 62 tests had to be modified, pointing out the magnitude of this change. And actually, I still would be surprised to see such an error message. It should not be possible to have a class/interface with the same name as a scalar type – and actually it is not. -- Christoph M. Becker

« previous php.internals (#100720) next »