MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all them part of the Moodle's CodeSniffer standard: - PSR12.Functions.ReturnTypeDeclaration - PSR12.Functions.NullableTypeDeclaration - moodle.Methods.MethodDeclarationSpacing - Squiz.Whitespace.ScopeKeywordSpacing All them are, exclusively, about correct spacing, so the changes are, all them, only white space changes. Only exceptions to the above are 3 changes what were setting the return type in a new line, and, when that happens, the closing parenthesis (bracket) has to go to the same line than the colon.
This commit is contained in:
@@ -83,7 +83,7 @@ abstract class data_controller {
|
||||
* @throws \coding_exception
|
||||
* @throws \moodle_exception
|
||||
*/
|
||||
public static function create(int $id, \stdClass $record = null, field_controller $field = null) : data_controller {
|
||||
public static function create(int $id, \stdClass $record = null, field_controller $field = null): data_controller {
|
||||
global $DB;
|
||||
if ($id && $record) {
|
||||
// This warning really should be in persistent as well.
|
||||
@@ -123,7 +123,7 @@ abstract class data_controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_form_element_name() : string {
|
||||
public function get_form_element_name(): string {
|
||||
return 'customfield_' . $this->get_field()->get('shortname');
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ abstract class data_controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function datafield() : string;
|
||||
abstract public function datafield(): string;
|
||||
|
||||
/**
|
||||
* Delete data. Element can override it if related information needs to be deleted as well (such as files)
|
||||
@@ -186,7 +186,7 @@ abstract class data_controller {
|
||||
*
|
||||
* @return field_controller
|
||||
*/
|
||||
public function get_field() : field_controller {
|
||||
public function get_field(): field_controller {
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ abstract class data_controller {
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_empty($value) : bool {
|
||||
protected function is_empty($value): bool {
|
||||
if ($this->datafield() === 'value' || $this->datafield() === 'charvalue' || $this->datafield() === 'shortcharvalue') {
|
||||
return '' . $value === '';
|
||||
}
|
||||
@@ -237,7 +237,7 @@ abstract class data_controller {
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_unique($value) : bool {
|
||||
protected function is_unique($value): bool {
|
||||
global $DB;
|
||||
|
||||
// Ensure the "value" datafield can be safely compared across all databases.
|
||||
@@ -262,7 +262,7 @@ abstract class data_controller {
|
||||
* @param array $files
|
||||
* @return array array of errors
|
||||
*/
|
||||
public function instance_form_validation(array $data, array $files) : array {
|
||||
public function instance_form_validation(array $data, array $files): array {
|
||||
$errors = [];
|
||||
$elementname = $this->get_form_element_name();
|
||||
if ($this->get_field()->get_configdata_property('uniquevalues') == 1) {
|
||||
@@ -288,7 +288,7 @@ abstract class data_controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function display() : string {
|
||||
public function display(): string {
|
||||
global $PAGE;
|
||||
$output = $PAGE->get_renderer('core_customfield');
|
||||
return $output->render(new field_data($this));
|
||||
@@ -318,7 +318,7 @@ abstract class data_controller {
|
||||
*
|
||||
* @return \context
|
||||
*/
|
||||
public function get_context() : \context {
|
||||
public function get_context(): \context {
|
||||
if ($this->get('contextid')) {
|
||||
return \context::instance_by_id($this->get('contextid'));
|
||||
} else if ($this->get('instanceid')) {
|
||||
|
||||
Reference in New Issue
Block a user