Confusing type mismatch error messages

From: Date: Wed, 20 Sep 2017 15:23:07 +0000
Subject: Confusing type mismatch error messages
Groups: php.internals 
Request: Send a blank email to internals+get-100716@lists.php.net to get a copy of this message
Hi everybody! If a type declaration inadvertently uses boolean or integer (instead of bool and int, respectively), the error message is rather confusing: […] must be an instance of boolean, boolean given, […] 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. bool and int, respectively, so the message above would read: […] must be an instance of boolean, bool given, […] This change would still be a BC break, but at a far smaller scale than Adam's PR would have been. So I am asking for opinions whether this change would be worth the BC break, and whether a respective RFC could target PHP 7.3, or would have to wait for PHP 8. -- Christoph M. Becker

« previous php.internals (#100716) next »