Skip to content

Commit

Permalink
Add string type declarations to global API functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfb committed Nov 19, 2019
1 parent 9b59455 commit 0b0b329
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @return array|int
*/
function civicrm_api($entity, $action, array $params, $extra = NULL) {
function civicrm_api(string $entity, string $action, array $params, $extra = NULL) {
return \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params, $extra);
}

Expand All @@ -37,7 +37,7 @@ function civicrm_api($entity, $action, array $params, $extra = NULL) {
* @throws \API_Exception
* @throws \Civi\API\Exception\NotImplementedException
*/
function civicrm_api4($entity, $action, array $params = [], $index = NULL) {
function civicrm_api4(string $entity, string $action, array $params = [], $index = NULL) {
$apiCall = \Civi\Api4\Utils\ActionUtil::getAction($entity, $action);
foreach ($params as $name => $param) {
$setter = 'set' . ucfirst($name);
Expand Down Expand Up @@ -81,7 +81,7 @@ function civicrm_api4($entity, $action, array $params = [], $index = NULL) {
*
* @return array
*/
function civicrm_api3($entity, $action, array $params = []) {
function civicrm_api3(string $entity, string $action, array $params = []) {
$params['version'] = 3;
$result = \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params);
if (is_array($result) && !empty($result['is_error'])) {
Expand Down

0 comments on commit 0b0b329

Please sign in to comment.