Skip to content

Commit a4478d1

Browse files
authored
Merge pull request #249 from argiepiano/1.x-2-x.issue-248
Issue #248. Fix nullables for PHP 8.4
2 parents a8ea28f + 142c67f commit a4478d1

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

includes/rules.core.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class RulesEntityController extends EntityPlusControllerExportable {
178178
return $config;
179179
}
180180

181-
public function save($rules_config, DatabaseTransaction $transaction = NULL) {
181+
public function save($rules_config, ?DatabaseTransaction $transaction = NULL) {
182182
$transaction = isset($transaction) ? $transaction : db_transaction();
183183

184184
// Load the stored entity, if any.
@@ -296,7 +296,7 @@ class RulesEntityController extends EntityPlusControllerExportable {
296296
*
297297
* @see EntityAPIControllerExportable::delete()
298298
*/
299-
public function delete($ids, DatabaseTransaction $transaction = NULL) {
299+
public function delete($ids, ?DatabaseTransaction $transaction = NULL) {
300300
$transaction = isset($transaction) ? $transaction : db_transaction();
301301
// Use entity-load as ids may be the names as well as the ids.
302302
$configs = $ids ? entity_load('rules_config', $ids) : array();
@@ -1745,7 +1745,7 @@ abstract class RulesAbstractPlugin extends RulesPlugin {
17451745
/**
17461746
* Execute the configured execution callback and log that.
17471747
*/
1748-
abstract protected function executeCallback(array $args, RulesState $state = NULL);
1748+
abstract protected function executeCallback(array $args, ?RulesState $state = NULL);
17491749

17501750
public function evaluate(RulesState $state) {
17511751
$this->processSettings();

includes/rules.plugins.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class RulesAction extends RulesAbstractPlugin implements RulesActionInterface {
1717
/**
1818
* Execute the callback and update/save data as specified by the action.
1919
*/
20-
protected function executeCallback(array $args, RulesState $state = NULL) {
20+
protected function executeCallback(array $args, ?RulesState $state = NULL) {
2121
rules_log('Evaluating the action %name.', array(
2222
'%name' => $this->label($this->elementName),
2323
), RulesLog::INFO, $this);
@@ -107,7 +107,7 @@ class RulesCondition extends RulesAbstractPlugin implements RulesConditionInterf
107107
return $this->negate;
108108
}
109109

110-
protected function executeCallback(array $args, RulesState $state = NULL) {
110+
protected function executeCallback(array $args, ?RulesState $state = NULL) {
111111
$return = (bool) $this->__call('execute', empty($this->info['named parameter']) ? $args : array($args));
112112
$return = $this->negate ? !$return : $return;
113113
rules_log('The condition %name evaluated to %bool', array(
@@ -416,7 +416,7 @@ class RulesReactionRule extends Rule implements RulesTriggerableInterface {
416416
/**
417417
* Implements RulesTriggerableInterface::event().
418418
*/
419-
public function event($event_name, array $settings = NULL) {
419+
public function event($event_name, ?array $settings = NULL) {
420420
// Process any settings and determine the configured event's name.
421421
if ($settings) {
422422
$handler = rules_get_event_handler($event_name, $settings);

rules.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function rules_action_set($variables = array(), $provides = array()) {
216216
* (optional) This may be used to denote the beginning (TRUE) or the end
217217
* (FALSE) of a new execution scope.
218218
*/
219-
function rules_log($msg, $args = array(), $priority = RulesLog::INFO, RulesPlugin $element = NULL, $scope = NULL) {
219+
function rules_log($msg, $args = array(), $priority = RulesLog::INFO, ?RulesPlugin $element = NULL, $scope = NULL) {
220220
static $logger, $settings;
221221

222222
// Statically cache the variable settings as this is called very often.
@@ -711,7 +711,7 @@ function rules_get_event_base_name($event_name) {
711711
* @return RulesEventHandlerInterface
712712
* The event handler.
713713
*/
714-
function rules_get_event_handler($event_name, array $settings = NULL) {
714+
function rules_get_event_handler($event_name, ?array $settings = NULL) {
715715
$event_name = rules_get_event_base_name($event_name);
716716
$event_info = rules_get_event_info($event_name);
717717
$class = !empty($event_info['class']) ? $event_info['class'] : 'RulesEventDefaultHandler';

ui/ui.core.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ class RulesPluginUI extends FacesExtender implements RulesPluginUIInterface {
862862
* Generates a path using the given operation for the element with the given
863863
* id of the configuration with the given name.
864864
*/
865-
public static function path($name, $op = NULL, RulesPlugin $element = NULL, $parameter = FALSE) {
865+
public static function path($name, $op = NULL, ?RulesPlugin $element = NULL, $parameter = FALSE) {
866866
$element_id = isset($element) ? $element->elementId() : FALSE;
867867
if (isset(self::$basePath)) {
868868
$base_path = self::$basePath;

0 commit comments

Comments
 (0)