We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5eebd7 commit e675a4dCopy full SHA for e675a4d
1 file changed
system/Entity.php
@@ -412,6 +412,7 @@ protected function mutateDate($value)
412
413
/**
414
* Provides the ability to cast an item as a specific data type.
415
+ * Add ? at the beginning of $type (i.e. ?string) to get NULL instead of castig $value if $value === null
416
*
417
* @param $value
418
* @param string $type
@@ -426,6 +427,7 @@ protected function castAs($value, string $type)
426
427
switch($type)
428
{
429
case 'integer':
430
+ case 'int': //alias for 'integer'
431
$value = (int)$value;
432
break;
433
case 'float':
@@ -438,6 +440,7 @@ protected function castAs($value, string $type)
438
440
$value = (string)$value;
439
441
442
case 'boolean':
443
+ case 'bool': //alias for 'boolean'
444
$value = (bool)$value;
445
446
case 'object':
0 commit comments