Skip to content

Commit

Permalink
MDL-82571 customfield_number: small coding style cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Sep 4, 2024
1 parent cbcb9d0 commit 865e8f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion customfield/field/number/classes/field_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function config_form_validation(array $data, $files = []): array {
* @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;
Expand Down
12 changes: 6 additions & 6 deletions customfield/field/number/tests/data_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ public static function export_value_provider(): array {
'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,
]],
];
}

Expand Down

0 comments on commit 865e8f3

Please sign in to comment.