[REF][PHP8.1] Fix a couple of deprecations in php8.1 by specifying that return type...
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 21 Jun 2022 06:11:57 +0000 (16:11 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 9 Jul 2022 00:30:39 +0000 (10:30 +1000)
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

CRM/Core/I18n.php
CRM/Utils/SQL/BaseParamQuery.php

index bcb214d66e5e50f6846c9fb922ee001e75bf652b..9c3c0fe2129806b7e01c0370cfd2fd4fe144402e 100644 (file)
@@ -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;
       }
     }
index b0bf8633d0a34379653c80b3ddf08f33d732a4ee..960dec4cbf6695778096cfb7724b97d2127cb3e6 100644 (file)
@@ -184,7 +184,7 @@ class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess {
    *
    * @return bool
    */
-  public function offsetExists($offset) {
+  public function offsetExists($offset): bool {
     return isset($this->params[$offset]);
   }
 
@@ -202,6 +202,7 @@ class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess {
    * @see param()
    * @see ArrayAccess::offsetGet
    */
+  #[ReturnTypeWillChange]
   public function offsetGet($offset) {
     return $this->params[$offset];
   }
@@ -223,7 +224,7 @@ class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess {
    * @see param()
    * @see ArrayAccess::offsetSet
    */
-  public function offsetSet($offset, $value) {
+  public function offsetSet($offset, $value): void {
     $this->param($offset, $value);
   }
 
@@ -234,7 +235,7 @@ class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess {
    * @see param()
    * @see ArrayAccess::offsetUnset
    */
-  public function offsetUnset($offset) {
+  public function offsetUnset($offset): void {
     unset($this->params[$offset]);
   }