Skip to content

Commit

Permalink
[REF][PHP8.1] Fix a couple of deprecations in php8.1 by specifying th…
Browse files Browse the repository at this point in the history
…at return type may change in BaseParamQuery and by ensuring that we don't pass null into function_exists in I18n class

Replace some ReturnTypeWillChange with later return types as they should be backward compatible

Dave D Fix

Completely switch to just not empty on the customTranslationFunction check
  • Loading branch information
seamuslee001 committed Jul 9, 2022
1 parent c44d548 commit fc651f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ function ts($text, $params = []) {
if ($bootstrapReady) {
// just got ready: determine whether there is a working custom translation function
$config = CRM_Core_Config::singleton();
if (isset($config->customTranslateFunction) and function_exists($config->customTranslateFunction)) {
if (!empty($config->customTranslateFunction) && function_exists($config->customTranslateFunction)) {
$function = $config->customTranslateFunction;
}
}
Expand Down
7 changes: 4 additions & 3 deletions CRM/Utils/SQL/BaseParamQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function param($keys, $value = NULL) {
*
* @return bool
*/
public function offsetExists($offset) {
public function offsetExists($offset): bool {
return isset($this->params[$offset]);
}

Expand All @@ -202,6 +202,7 @@ public function offsetExists($offset) {
* @see param()
* @see ArrayAccess::offsetGet
*/
#[ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->params[$offset];
}
Expand All @@ -223,7 +224,7 @@ public function offsetGet($offset) {
* @see param()
* @see ArrayAccess::offsetSet
*/
public function offsetSet($offset, $value) {
public function offsetSet($offset, $value): void {
$this->param($offset, $value);
}

Expand All @@ -234,7 +235,7 @@ public function offsetSet($offset, $value) {
* @see param()
* @see ArrayAccess::offsetUnset
*/
public function offsetUnset($offset) {
public function offsetUnset($offset): void {
unset($this->params[$offset]);
}

Expand Down

0 comments on commit fc651f9

Please sign in to comment.