MDL-82571 customfield_number: small coding style cleanup.
This commit is contained in:
@@ -143,7 +143,7 @@ class field_controller extends \core_customfield\field_controller {
|
||||
* @return string|null
|
||||
*/
|
||||
public function prepare_field_for_display(mixed $value, ?context $context = null): ?string {
|
||||
if ((float)$value == 0) {
|
||||
if ((float) $value == 0) {
|
||||
$value = $this->get_configdata_property('displaywhenzero');
|
||||
if ((string) $value === '') {
|
||||
return null;
|
||||
|
||||
@@ -132,17 +132,17 @@ final class data_controller_test extends advanced_testcase {
|
||||
'Export float value' => [42, 42.0, [
|
||||
'decimalplaces' => 2,
|
||||
'display' => '{value}',
|
||||
'displaywhenzero' => 0],
|
||||
],
|
||||
'displaywhenzero' => 0,
|
||||
]],
|
||||
'Export value with a prefix' => [10, '$ 10.00', [
|
||||
'decimalplaces' => 2,
|
||||
'display' => $template,
|
||||
'displaywhenzero' => 0],
|
||||
],
|
||||
'displaywhenzero' => 0,
|
||||
]],
|
||||
'Export value when zero' => [0, 'Unknown', [
|
||||
'display' => '{value}',
|
||||
'displaywhenzero' => $whenzero],
|
||||
],
|
||||
'displaywhenzero' => $whenzero,
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user