fix: DTO의 기본 converter에서 bool은 0,1 가능
This commit is contained in:
@@ -78,11 +78,18 @@ class DefaultConverter implements Converter
|
||||
return $raw;
|
||||
}
|
||||
|
||||
if($type === 'bool' && is_bool($raw)){
|
||||
$success = true;
|
||||
return $raw;
|
||||
if($type === 'bool'){
|
||||
if(is_bool($raw)){
|
||||
$success = true;
|
||||
return $raw;
|
||||
}
|
||||
if($raw === 0 || $raw === 1){
|
||||
$success = true;
|
||||
return $raw !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -100,7 +107,7 @@ class DefaultConverter implements Converter
|
||||
}
|
||||
}
|
||||
|
||||
throw new \Exception('DefaultConverter can not convert');
|
||||
throw new \Exception('DefaultConverter can not convert '.gettype($raw));
|
||||
}
|
||||
|
||||
public function convertTo(mixed $data): string|array|int|float|bool|null
|
||||
|
||||
Reference in New Issue
Block a user