You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a function contains a declared parameter of bool and a default value set to true or false, it get incorrectly detected as boolean and thinks bool is different.
I recommend changing type boolean to bool.
In PHP boolean is a synonym of bool, but boolean values true and false are of type bool.
The importance of adhering to bool over boolean is because:
function test(boolean $test = true){ ... }
would produce a fatal error when the default is used.
When a function contains a declared parameter of
bool
and a default value set totrue
orfalse
, it get incorrectly detected asboolean
and thinksbool
is different.I recommend changing type
boolean
tobool
.In PHP
boolean
is a synonym ofbool
, but boolean valuestrue
andfalse
are of typebool
.The importance of adhering to
bool
overboolean
is because:would produce a fatal error when the default is used.
References:
https://stackoverflow.com/questions/44009037/php-bool-vs-boolean-type-hinting
https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration
https://www.php.net/manual/en/language.types.boolean.php
The text was updated successfully, but these errors were encountered: