Skip to content

Commit

Permalink
replace all call_user_func() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Aug 31, 2023
1 parent ede6eb5 commit ea344b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Form/Control/Multiline.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ protected function getComponentDefinition(Field $field): array
$definition = array_map(function ($value) use ($field) {
$this->issetOwner(); // prevent PHP CS Fixer to make this anonymous function static, TODO https://github.com/atk4/ui/pull/1625

return is_array($value) && is_callable($value) ? call_user_func($value, $field) : $value;
return is_array($value) && is_callable($value) ? $value($field) : $value;
}, $component);

return $definition;
Expand Down Expand Up @@ -630,7 +630,7 @@ protected function valuePropsBinding(string $values): void
foreach ($fieldValues as $rows) {
foreach ($rows as $fieldName => $value) {
if (array_key_exists($fieldName, $this->valuePropsBinding)) {
call_user_func($this->valuePropsBinding[$fieldName], $this->model->getField($fieldName), $value);
($this->valuePropsBinding[$fieldName])($this->model->getField($fieldName), $value);
}
}
}
Expand Down Expand Up @@ -681,7 +681,7 @@ private function outputJson(): void
$this->getApp()->terminateJson(['success' => true, 'expressions' => $expressionValues]);
// no break - expression above always terminate
case 'on-change':
$response = call_user_func($this->onChangeFunction, $this->typeCastLoadValues($this->getApp()->decodeJson($_POST['rows'])), $this->form);
$response = ($this->onChangeFunction)($this->typeCastLoadValues($this->getApp()->decodeJson($_POST['rows'])), $this->form);
$this->renderCallback->terminateAjax($this->renderCallback->getAjaxec($response));
// TODO JsCallback::terminateAjax() should return never
}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Control/ScopeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ protected function getRule(string $type, array $defaults = [], Field $field = nu
return array_merge(array_map(function ($value) use ($field, $options) {
$this->issetOwner(); // prevent PHP CS Fixer to make this anonymous function static, TODO https://github.com/atk4/ui/pull/1625

return is_array($value) && is_callable($value) ? call_user_func($value, $field, $options) : $value;
return is_array($value) && is_callable($value) ? $value($field, $options) : $value;
}, $rule), $defaults);
}

Expand Down
4 changes: 2 additions & 2 deletions src/UserAction/ExecutorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function createActionTrigger(UserAction $action, string $type = null):
}
}

$seed = is_array($seed) && is_callable($seed) ? call_user_func($seed, $action, $type) : $seed;
$seed = is_array($seed) && is_callable($seed) ? $seed($action, $type) : $seed;

return Factory::factory($seed);
}
Expand Down Expand Up @@ -242,7 +242,7 @@ protected function getActionCaption(UserAction $action, string $type = null): st
}
}

return is_array($caption) && is_callable($caption) ? call_user_func($caption, $action) : $caption;
return is_array($caption) && is_callable($caption) ? $caption($action) : $caption;
}

/**
Expand Down

0 comments on commit ea344b1

Please sign in to comment.