Re: [PHP7][Bug?] What is the difference between 'boolean' and 'bool'?

From: Date: Wed, 16 Dec 2015 23:33:58 +0000
Subject: Re: [PHP7][Bug?] What is the difference between 'boolean' and 'bool'?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-325296@lists.php.net to get a copy of this message
My bad! I totally missed the gist link. It definitely looks like PHP is treating "boolean" as a class name rather than a synonym for the "bool" scalar type. Sticking to "bool" seems to avoid the problem. Have you run into any cases where using "bool" fails? I recommend submitting a bug report to either make "boolean" work or remove it. It's interesting that they chose to disallow null values for scalar parameters, unlike classes and arrays. It would be nice to allow null by using something like this: function bar(bool? $foo) {...} BTW, I love the quirky yet logical error message "Argument 1 passed to bar() must be an instance of boolean, boolean given". David

« previous php.general (#325296) next »